From 73982eb0faffd8adbb0cda60d6a0dc2ca04162ed Mon Sep 17 00:00:00 2001 From: Mikhail Lipin Date: Mon, 3 Jul 2023 01:41:35 +0300 Subject: [PATCH 1/5] Refactoring: base classes for operations. --- .../Tools/Benchmark/Fx/BenchmarkOperation.cs | 15 +++++++++++++++ .../Benchmark/Fx/InsertBenchmarkOperation.cs | 13 +++++++++++++ .../Tools/Benchmark/Fx/QueryBenchmarkOperation.cs | 10 ++++++++++ .../Tools/Benchmark/Fx/ReadBenchmarkOperation.cs | 10 ++++++++++ .../Tools/Benchmark/IBenchmarkOperation.cs | 15 +++++++++++++-- .../Benchmark/v2/InsertV2BenchmarkOperation.cs | 6 +++--- .../v2/QueryStreamSinglePkV2BenchmarkOperation.cs | 6 +++--- .../v2/QueryTSinglePkV2BenchmarkOperation.cs | 6 +++--- .../v2/ReadFeedStreamV2BenchmarkOperation.cs | 6 +++--- .../v2/ReadNotExistsV2BenchmarkOperation.cs | 6 +++--- .../v2/ReadStreamExistsV2BenchmarkOperation.cs | 6 +++--- .../v2/ReadTExistsV2BenchmarkOperation.cs | 6 +++--- .../Benchmark/v3/InsertV3BenchmarkOperation.cs | 6 +++--- .../Benchmark/v3/QueryTV3BenchmarkOperation.cs | 6 +++--- .../v3/ReadFeedStreamV3BenchmarkOperation.cs | 6 +++--- .../v3/ReadNotExistsV3BenchmarkOperation.cs | 6 +++--- .../v3/ReadStreamExistsV3BenchmarkOperation.cs | 6 +++--- ...amExistsWithDiagnosticsV3BenchmarkOperation.cs | 6 +++--- .../v3/ReadTExistsV3BenchmarkOperation.cs | 6 +++--- 19 files changed, 103 insertions(+), 44 deletions(-) create mode 100644 Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs create mode 100644 Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs create mode 100644 Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs create mode 100644 Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs new file mode 100644 index 0000000000..8cf2da3278 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace CosmosBenchmark +{ + using System.Threading.Tasks; + + internal abstract class BenchmarkOperation : IBenchmarkOperation + { + public abstract Task ExecuteOnceAsync(); + + public abstract Task PrepareAsync(); + } +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs new file mode 100644 index 0000000000..549db58a4e --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace CosmosBenchmark +{ + /// + /// Represents the Benchmark insert operation. + /// + internal abstract class InsertBenchmarkOperation : BenchmarkOperation + { + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs new file mode 100644 index 0000000000..1308a9b83e --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs @@ -0,0 +1,10 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace CosmosBenchmark +{ + internal abstract class QueryBenchmarkOperation : BenchmarkOperation + { + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs new file mode 100644 index 0000000000..55e42af491 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs @@ -0,0 +1,10 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace CosmosBenchmark +{ + internal abstract class ReadBenchmarkOperation : BenchmarkOperation + { + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs index d6933fcce5..b1e4df27e5 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs @@ -6,10 +6,21 @@ namespace CosmosBenchmark { using System.Threading.Tasks; + /// + /// Representes the Benchmark operation. + /// internal interface IBenchmarkOperation { - Task PrepareAsync(); - + /// + /// Executes Benchmark operation once asynchronously. + /// + /// The operation result wrapped by task. Task ExecuteOnceAsync(); + + /// + /// Prepares Benchmark operation asynchronously. + /// + /// The task related to method's work. + Task PrepareAsync(); } } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/InsertV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/InsertV2BenchmarkOperation.cs index 744bb9f577..e01ab060e8 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/InsertV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/InsertV2BenchmarkOperation.cs @@ -10,7 +10,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; - internal class InsertV2BenchmarkOperation : IBenchmarkOperation + internal class InsertV2BenchmarkOperation : InsertBenchmarkOperation { private readonly DocumentClient documentClient; private readonly Uri containerUri; @@ -38,7 +38,7 @@ public InsertV2BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { ResourceResponse itemResponse = await this.documentClient.CreateDocumentAsync( this.containerUri, @@ -58,7 +58,7 @@ public async Task ExecuteOnceAsync() }; } - public Task PrepareAsync() + public override Task PrepareAsync() { string newPartitionKey = Guid.NewGuid().ToString(); diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryStreamSinglePkV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryStreamSinglePkV2BenchmarkOperation.cs index 1bf3bf245e..908850dd39 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryStreamSinglePkV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryStreamSinglePkV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents.Client; using Microsoft.Azure.Documents.Linq; - internal class QueryStreamSinglePkV2BenchmarkOperation : IBenchmarkOperation + internal class QueryStreamSinglePkV2BenchmarkOperation : QueryBenchmarkOperation { private readonly DocumentClient documentClient; private readonly string partitionKeyPath; @@ -47,7 +47,7 @@ public QueryStreamSinglePkV2BenchmarkOperation( this.containerUri = UriFactory.CreateDocumentCollectionUri(this.databsaeName, this.containerName); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { IDocumentQuery query = this.documentClient.CreateDocumentQuery( this.containerUri, @@ -85,7 +85,7 @@ public async Task ExecuteOnceAsync() }; } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (this.initialized) { diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryTSinglePkV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryTSinglePkV2BenchmarkOperation.cs index 7d58447859..3cc32d295e 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryTSinglePkV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryTSinglePkV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents.Client; using Microsoft.Azure.Documents.Linq; - internal class QueryTSinglePkV2BenchmarkOperation : IBenchmarkOperation + internal class QueryTSinglePkV2BenchmarkOperation : QueryBenchmarkOperation { private readonly DocumentClient documentClient; private readonly string partitionKeyPath; @@ -46,7 +46,7 @@ public QueryTSinglePkV2BenchmarkOperation( this.sampleJObject[this.partitionKeyPath] = this.executionItemPartitionKey; } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { IDocumentQuery> query = this.documentClient.CreateDocumentQuery>( this.containerUri, @@ -93,7 +93,7 @@ public async Task ExecuteOnceAsync() }; } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (this.initialized) { diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadFeedStreamV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadFeedStreamV2BenchmarkOperation.cs index 379cd363e6..dd687e0f8b 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadFeedStreamV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadFeedStreamV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; - internal class ReadFeedStreamV2BenchmarkOperation : IBenchmarkOperation + internal class ReadFeedStreamV2BenchmarkOperation : ReadBenchmarkOperation { private readonly DocumentClient documentClient; private readonly string partitionKeyPath; @@ -40,7 +40,7 @@ public ReadFeedStreamV2BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { Uri containerUri = UriFactory.CreateDocumentCollectionUri(this.databsaeName, this.containerName); FeedResponse feedResponse = await this.documentClient.ReadDocumentFeedAsync( @@ -57,7 +57,7 @@ public async Task ExecuteOnceAsync() }; } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadNotExistsV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadNotExistsV2BenchmarkOperation.cs index f5e8f94c68..4c66893495 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadNotExistsV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadNotExistsV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; - internal class ReadNotExistsV2BenchmarkOperation : IBenchmarkOperation + internal class ReadNotExistsV2BenchmarkOperation : ReadBenchmarkOperation { private readonly string databsaeName; private readonly string containerName; @@ -35,7 +35,7 @@ public ReadNotExistsV2BenchmarkOperation( this.containerName = containerName; } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { Uri itemUri = UriFactory.CreateDocumentUri(this.databsaeName, this.containerName, this.nextExecutionItemId); @@ -65,7 +65,7 @@ public async Task ExecuteOnceAsync() } } - public Task PrepareAsync() + public override Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadStreamExistsV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadStreamExistsV2BenchmarkOperation.cs index 7afd4cdf71..fda0c58c43 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadStreamExistsV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadStreamExistsV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; - internal class ReadStreamExistsV2BenchmarkOperation : IBenchmarkOperation + internal class ReadStreamExistsV2BenchmarkOperation : ReadBenchmarkOperation { private readonly string partitionKeyPath; private readonly Dictionary sampleJObject; @@ -41,7 +41,7 @@ public ReadStreamExistsV2BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { Uri itemUri = UriFactory.CreateDocumentUri(this.databsaeName, this.containerName, this.nextExecutionItemId); ResourceResponse itemResponse = await this.documentClient.ReadDocumentAsync( @@ -61,7 +61,7 @@ public async Task ExecuteOnceAsync() }; } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadTExistsV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadTExistsV2BenchmarkOperation.cs index 061183c575..fa9cd81c98 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadTExistsV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadTExistsV2BenchmarkOperation.cs @@ -13,7 +13,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents.Client; using Newtonsoft.Json.Linq; - internal class ReadTExistsV2BenchmarkOperation : IBenchmarkOperation + internal class ReadTExistsV2BenchmarkOperation : ReadBenchmarkOperation { private readonly string partitionKeyPath; private readonly Dictionary sampleJObject; @@ -42,7 +42,7 @@ public ReadTExistsV2BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { Uri itemUri = UriFactory.CreateDocumentUri(this.databsaeName, this.containerName, this.nextExecutionItemId); DocumentResponse> itemResponse = await this.documentClient.ReadDocumentAsync>( @@ -62,7 +62,7 @@ public async Task ExecuteOnceAsync() }; } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/InsertV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/InsertV3BenchmarkOperation.cs index 1ab5861242..81f9da9c87 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/InsertV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/InsertV3BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Newtonsoft.Json; using Newtonsoft.Json.Serialization; - internal class InsertV3BenchmarkOperation : IBenchmarkOperation + internal class InsertV3BenchmarkOperation : InsertBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -37,7 +37,7 @@ public InsertV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) { @@ -60,7 +60,7 @@ public async Task ExecuteOnceAsync() } } - public Task PrepareAsync() + public override Task PrepareAsync() { string newPartitionKey = Guid.NewGuid().ToString(); this.sampleJObject["id"] = Guid.NewGuid().ToString(); diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs index bdb0b38cf8..5eb8fba252 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs @@ -11,7 +11,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal abstract class QueryTV3BenchmarkOperation : IBenchmarkOperation + internal abstract class QueryTV3BenchmarkOperation : QueryBenchmarkOperation { protected readonly Container container; protected readonly Dictionary sampleJObject; @@ -55,7 +55,7 @@ public QueryTV3BenchmarkOperation( /// /// /// - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { if (this.IsQueryStream) { @@ -258,7 +258,7 @@ private async Task ExecuteOnceAsyncWithStreamsAndPagination() /// /// /// - public virtual async Task PrepareAsync() + public override async Task PrepareAsync() { if (this.initialized) { diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadFeedStreamV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadFeedStreamV3BenchmarkOperation.cs index 99789040b0..3917470691 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadFeedStreamV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadFeedStreamV3BenchmarkOperation.cs @@ -11,7 +11,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal class ReadFeedStreamV3BenchmarkOperation : IBenchmarkOperation + internal class ReadFeedStreamV3BenchmarkOperation : ReadBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -39,7 +39,7 @@ public ReadFeedStreamV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { FeedIterator feedIterator = this.container .GetItemQueryStreamIterator( @@ -63,7 +63,7 @@ public async Task ExecuteOnceAsync() }; } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadNotExistsV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadNotExistsV3BenchmarkOperation.cs index c97d1af4b7..fcec5a46fd 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadNotExistsV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadNotExistsV3BenchmarkOperation.cs @@ -9,7 +9,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal class ReadNotExistsV3BenchmarkOperation : IBenchmarkOperation + internal class ReadNotExistsV3BenchmarkOperation : ReadBenchmarkOperation { private readonly Container container; @@ -32,7 +32,7 @@ public ReadNotExistsV3BenchmarkOperation( this.container = cosmosClient.GetContainer(this.databsaeName, this.containerName); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { using (ResponseMessage itemResponse = await this.container.ReadItemStreamAsync( this.nextExecutionItemId, @@ -54,7 +54,7 @@ public async Task ExecuteOnceAsync() } } - public Task PrepareAsync() + public override Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsV3BenchmarkOperation.cs index aba0a4ea7a..6695f721b6 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsV3BenchmarkOperation.cs @@ -11,7 +11,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal class ReadStreamExistsV3BenchmarkOperation : IBenchmarkOperation + internal class ReadStreamExistsV3BenchmarkOperation : ReadBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -39,7 +39,7 @@ public ReadStreamExistsV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { using (ResponseMessage itemResponse = await this.container.ReadItemStreamAsync( this.nextExecutionItemId, @@ -61,7 +61,7 @@ public async Task ExecuteOnceAsync() } } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsWithDiagnosticsV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsWithDiagnosticsV3BenchmarkOperation.cs index ebdc14924b..580b9cd375 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsWithDiagnosticsV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsWithDiagnosticsV3BenchmarkOperation.cs @@ -11,7 +11,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal class ReadStreamExistsWithDiagnosticsV3BenchmarkOperation : IBenchmarkOperation + internal class ReadStreamExistsWithDiagnosticsV3BenchmarkOperation : ReadBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -39,7 +39,7 @@ public ReadStreamExistsWithDiagnosticsV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { using (ResponseMessage itemResponse = await this.container.ReadItemStreamAsync( this.nextExecutionItemId, @@ -67,7 +67,7 @@ public async Task ExecuteOnceAsync() } } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadTExistsV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadTExistsV3BenchmarkOperation.cs index 7fd40397be..392a38691e 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadTExistsV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadTExistsV3BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Cosmos; using Newtonsoft.Json.Linq; - internal class ReadTExistsV3BenchmarkOperation : IBenchmarkOperation + internal class ReadTExistsV3BenchmarkOperation : ReadBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -40,7 +40,7 @@ public ReadTExistsV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public async Task ExecuteOnceAsync() + public override async Task ExecuteOnceAsync() { ItemResponse> itemResponse = await this.container.ReadItemAsync>( this.nextExecutionItemId, @@ -60,7 +60,7 @@ public async Task ExecuteOnceAsync() }; } - public async Task PrepareAsync() + public override async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) From d47a4e3ad5ed4462566658936016c516af6ec9e3 Mon Sep 17 00:00:00 2001 From: Mikhail Lipin Date: Wed, 5 Jul 2023 23:05:27 +0300 Subject: [PATCH 2/5] Updating comments. --- .../Tools/Benchmark/Fx/BenchmarkOperation.cs | 11 +++++++++++ .../Tools/Benchmark/Fx/QueryBenchmarkOperation.cs | 3 +++ .../Tools/Benchmark/Fx/ReadBenchmarkOperation.cs | 3 +++ .../Tools/Benchmark/IBenchmarkOperation.cs | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs index 8cf2da3278..7133a7b319 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs @@ -6,10 +6,21 @@ namespace CosmosBenchmark { using System.Threading.Tasks; + /// + /// Represents the Benchmark operation. + /// internal abstract class BenchmarkOperation : IBenchmarkOperation { + /// + /// Executes Benchmark operation once asynchronously. + /// + /// The operation result wrapped by task. public abstract Task ExecuteOnceAsync(); + /// + /// Prepares Benchmark operation asynchronously. + /// + /// The task related to method's work. public abstract Task PrepareAsync(); } } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs index 1308a9b83e..be574b6fac 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs @@ -4,6 +4,9 @@ namespace CosmosBenchmark { + /// + /// Represents the Benchmark query operation. + /// internal abstract class QueryBenchmarkOperation : BenchmarkOperation { } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs index 55e42af491..a4b5363d21 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs @@ -4,6 +4,9 @@ namespace CosmosBenchmark { + /// + /// Represents the Benchmark read operation. + /// internal abstract class ReadBenchmarkOperation : BenchmarkOperation { } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs index b1e4df27e5..a5256aa3b5 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs @@ -7,7 +7,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; /// - /// Representes the Benchmark operation. + /// Represents the Benchmark operation. /// internal interface IBenchmarkOperation { From e4f34a95d583722894e4866585e68827398d86c4 Mon Sep 17 00:00:00 2001 From: Mikhail Lipin Date: Thu, 6 Jul 2023 21:50:42 +0300 Subject: [PATCH 3/5] Adding new line at the end of the file. --- .../Tools/Benchmark/Fx/InsertBenchmarkOperation.cs | 2 +- .../Tools/Benchmark/Fx/QueryBenchmarkOperation.cs | 2 +- .../Tools/Benchmark/Fx/ReadBenchmarkOperation.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs index 549db58a4e..51f9e06302 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs @@ -10,4 +10,4 @@ namespace CosmosBenchmark internal abstract class InsertBenchmarkOperation : BenchmarkOperation { } -} \ No newline at end of file +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs index be574b6fac..a7fe6b4b91 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs @@ -10,4 +10,4 @@ namespace CosmosBenchmark internal abstract class QueryBenchmarkOperation : BenchmarkOperation { } -} \ No newline at end of file +} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs index a4b5363d21..b779a9958a 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs @@ -10,4 +10,4 @@ namespace CosmosBenchmark internal abstract class ReadBenchmarkOperation : BenchmarkOperation { } -} \ No newline at end of file +} From ea36576f7029eda32bba7090e3a7eae4b52f4ecf Mon Sep 17 00:00:00 2001 From: Mikhail Lipin Date: Tue, 11 Jul 2023 01:07:01 +0300 Subject: [PATCH 4/5] Fixing code review points. --- ...Operation.cs => BenchmarkOperationType.cs} | 9 ++++--- .../Tools/Benchmark/Fx/BenchmarkOperation.cs | 26 ------------------- .../Benchmark/Fx/CosmosDiagnosticsLogger.cs | 3 --- .../Benchmark/Fx/InsertBenchmarkOperation.cs | 13 ---------- .../Benchmark/Fx/QueryBenchmarkOperation.cs | 13 ---------- .../Tools/Benchmark/IBenchmarkOperation.cs | 5 ++++ .../v2/InsertV2BenchmarkOperation.cs | 8 +++--- ...QueryStreamSinglePkV2BenchmarkOperation.cs | 8 +++--- .../v2/QueryTSinglePkV2BenchmarkOperation.cs | 10 ++++--- .../v2/ReadFeedStreamV2BenchmarkOperation.cs | 10 ++++--- .../v2/ReadNotExistsV2BenchmarkOperation.cs | 10 ++++--- .../ReadStreamExistsV2BenchmarkOperation.cs | 10 ++++--- .../v2/ReadTExistsV2BenchmarkOperation.cs | 10 ++++--- .../v3/InsertV3BenchmarkOperation.cs | 8 +++--- .../v3/QueryTV3BenchmarkOperation.cs | 10 ++++--- .../v3/ReadFeedStreamV3BenchmarkOperation.cs | 12 +++++---- .../v3/ReadNotExistsV3BenchmarkOperation.cs | 10 ++++--- .../ReadStreamExistsV3BenchmarkOperation.cs | 8 +++--- ...istsWithDiagnosticsV3BenchmarkOperation.cs | 10 ++++--- .../v3/ReadTExistsV3BenchmarkOperation.cs | 13 +++++----- 20 files changed, 93 insertions(+), 113 deletions(-) rename Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/{Fx/ReadBenchmarkOperation.cs => BenchmarkOperationType.cs} (52%) delete mode 100644 Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs delete mode 100644 Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs delete mode 100644 Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/BenchmarkOperationType.cs similarity index 52% rename from Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs rename to Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/BenchmarkOperationType.cs index b779a9958a..b18fb1c318 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/ReadBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/BenchmarkOperationType.cs @@ -1,13 +1,16 @@ -//------------------------------------------------------------ +//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ namespace CosmosBenchmark { /// - /// Represents the Benchmark read operation. + /// Benchmark operation type. /// - internal abstract class ReadBenchmarkOperation : BenchmarkOperation + public enum BenchmarkOperationType { + Read, + Insert, + Query } } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs deleted file mode 100644 index 7133a7b319..0000000000 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/BenchmarkOperation.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace CosmosBenchmark -{ - using System.Threading.Tasks; - - /// - /// Represents the Benchmark operation. - /// - internal abstract class BenchmarkOperation : IBenchmarkOperation - { - /// - /// Executes Benchmark operation once asynchronously. - /// - /// The operation result wrapped by task. - public abstract Task ExecuteOnceAsync(); - - /// - /// Prepares Benchmark operation asynchronously. - /// - /// The task related to method's work. - public abstract Task PrepareAsync(); - } -} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/CosmosDiagnosticsLogger.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/CosmosDiagnosticsLogger.cs index 9a399c5dc8..e08b2dd6da 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/CosmosDiagnosticsLogger.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/CosmosDiagnosticsLogger.cs @@ -6,11 +6,8 @@ namespace CosmosBenchmark { using System; using System.Collections.Concurrent; - using System.Collections.Generic; using System.Diagnostics; using System.Linq; - using System.Runtime.CompilerServices; - using System.Text; using Microsoft.Azure.Cosmos; using Newtonsoft.Json.Linq; diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs deleted file mode 100644 index 51f9e06302..0000000000 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/InsertBenchmarkOperation.cs +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace CosmosBenchmark -{ - /// - /// Represents the Benchmark insert operation. - /// - internal abstract class InsertBenchmarkOperation : BenchmarkOperation - { - } -} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs deleted file mode 100644 index a7fe6b4b91..0000000000 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Fx/QueryBenchmarkOperation.cs +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace CosmosBenchmark -{ - /// - /// Represents the Benchmark query operation. - /// - internal abstract class QueryBenchmarkOperation : BenchmarkOperation - { - } -} diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs index a5256aa3b5..3580a8a6fc 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/IBenchmarkOperation.cs @@ -11,6 +11,11 @@ namespace CosmosBenchmark /// internal interface IBenchmarkOperation { + /// + /// Benchmark operation type. + /// + BenchmarkOperationType OperationType { get; } + /// /// Executes Benchmark operation once asynchronously. /// diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/InsertV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/InsertV2BenchmarkOperation.cs index e01ab060e8..124c841085 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/InsertV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/InsertV2BenchmarkOperation.cs @@ -10,7 +10,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; - internal class InsertV2BenchmarkOperation : InsertBenchmarkOperation + internal class InsertV2BenchmarkOperation : IBenchmarkOperation { private readonly DocumentClient documentClient; private readonly Uri containerUri; @@ -38,7 +38,9 @@ public InsertV2BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Insert; + + public async Task ExecuteOnceAsync() { ResourceResponse itemResponse = await this.documentClient.CreateDocumentAsync( this.containerUri, @@ -58,7 +60,7 @@ public override async Task ExecuteOnceAsync() }; } - public override Task PrepareAsync() + public Task PrepareAsync() { string newPartitionKey = Guid.NewGuid().ToString(); diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryStreamSinglePkV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryStreamSinglePkV2BenchmarkOperation.cs index 908850dd39..b0f071f6de 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryStreamSinglePkV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryStreamSinglePkV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents.Client; using Microsoft.Azure.Documents.Linq; - internal class QueryStreamSinglePkV2BenchmarkOperation : QueryBenchmarkOperation + internal class QueryStreamSinglePkV2BenchmarkOperation : IBenchmarkOperation { private readonly DocumentClient documentClient; private readonly string partitionKeyPath; @@ -47,7 +47,9 @@ public QueryStreamSinglePkV2BenchmarkOperation( this.containerUri = UriFactory.CreateDocumentCollectionUri(this.databsaeName, this.containerName); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Query; + + public async Task ExecuteOnceAsync() { IDocumentQuery query = this.documentClient.CreateDocumentQuery( this.containerUri, @@ -85,7 +87,7 @@ public override async Task ExecuteOnceAsync() }; } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (this.initialized) { diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryTSinglePkV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryTSinglePkV2BenchmarkOperation.cs index 3cc32d295e..cd50a789b8 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryTSinglePkV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/QueryTSinglePkV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents.Client; using Microsoft.Azure.Documents.Linq; - internal class QueryTSinglePkV2BenchmarkOperation : QueryBenchmarkOperation + internal class QueryTSinglePkV2BenchmarkOperation : IBenchmarkOperation { private readonly DocumentClient documentClient; private readonly string partitionKeyPath; @@ -46,7 +46,9 @@ public QueryTSinglePkV2BenchmarkOperation( this.sampleJObject[this.partitionKeyPath] = this.executionItemPartitionKey; } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Query; + + public async Task ExecuteOnceAsync() { IDocumentQuery> query = this.documentClient.CreateDocumentQuery>( this.containerUri, @@ -93,7 +95,7 @@ public override async Task ExecuteOnceAsync() }; } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (this.initialized) { @@ -107,7 +109,7 @@ public override async Task PrepareAsync() new RequestOptions() { PartitionKey = new PartitionKey(this.executionItemPartitionKey) }); if (itemResponse.StatusCode != HttpStatusCode.Created) { - throw new Exception($"Create failed with statuscode: {itemResponse.StatusCode}"); + throw new Exception($"Create failed with status code: {itemResponse.StatusCode}"); } this.initialized = true; diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadFeedStreamV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadFeedStreamV2BenchmarkOperation.cs index dd687e0f8b..0a9b9e3d7f 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadFeedStreamV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadFeedStreamV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; - internal class ReadFeedStreamV2BenchmarkOperation : ReadBenchmarkOperation + internal class ReadFeedStreamV2BenchmarkOperation : IBenchmarkOperation { private readonly DocumentClient documentClient; private readonly string partitionKeyPath; @@ -40,7 +40,9 @@ public ReadFeedStreamV2BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task ExecuteOnceAsync() { Uri containerUri = UriFactory.CreateDocumentCollectionUri(this.databsaeName, this.containerName); FeedResponse feedResponse = await this.documentClient.ReadDocumentFeedAsync( @@ -57,7 +59,7 @@ public override async Task ExecuteOnceAsync() }; } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) @@ -75,7 +77,7 @@ public override async Task PrepareAsync() new RequestOptions() { PartitionKey = new PartitionKey(this.nextExecutionItemPartitionKey) }); if (itemResponse.StatusCode != HttpStatusCode.Created) { - throw new Exception($"Create failed with statuscode: {itemResponse.StatusCode}"); + throw new Exception($"Create failed with status code: {itemResponse.StatusCode}"); } } } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadNotExistsV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadNotExistsV2BenchmarkOperation.cs index 4c66893495..1d8b99449e 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadNotExistsV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadNotExistsV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; - internal class ReadNotExistsV2BenchmarkOperation : ReadBenchmarkOperation + internal class ReadNotExistsV2BenchmarkOperation : IBenchmarkOperation { private readonly string databsaeName; private readonly string containerName; @@ -22,6 +22,8 @@ internal class ReadNotExistsV2BenchmarkOperation : ReadBenchmarkOperation private readonly DocumentClient documentClient; + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + public ReadNotExistsV2BenchmarkOperation( DocumentClient documentClient, string dbName, @@ -35,7 +37,7 @@ public ReadNotExistsV2BenchmarkOperation( this.containerName = containerName; } - public override async Task ExecuteOnceAsync() + public async Task ExecuteOnceAsync() { Uri itemUri = UriFactory.CreateDocumentUri(this.databsaeName, this.containerName, this.nextExecutionItemId); @@ -52,7 +54,7 @@ public override async Task ExecuteOnceAsync() { if (dce.StatusCode != HttpStatusCode.NotFound) { - throw new Exception($"ReadItem failed wth {dce?.StatusCode} {dce?.ToString()}"); + throw new Exception($"ReadItem failed with {dce?.StatusCode} {dce?.ToString()}"); } return new OperationResult() @@ -65,7 +67,7 @@ public override async Task ExecuteOnceAsync() } } - public override Task PrepareAsync() + public Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadStreamExistsV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadStreamExistsV2BenchmarkOperation.cs index fda0c58c43..c7419db811 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadStreamExistsV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadStreamExistsV2BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; - internal class ReadStreamExistsV2BenchmarkOperation : ReadBenchmarkOperation + internal class ReadStreamExistsV2BenchmarkOperation : IBenchmarkOperation { private readonly string partitionKeyPath; private readonly Dictionary sampleJObject; @@ -25,6 +25,8 @@ internal class ReadStreamExistsV2BenchmarkOperation : ReadBenchmarkOperation private readonly DocumentClient documentClient; + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + public ReadStreamExistsV2BenchmarkOperation( DocumentClient documentClient, string dbName, @@ -41,7 +43,7 @@ public ReadStreamExistsV2BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public async Task ExecuteOnceAsync() { Uri itemUri = UriFactory.CreateDocumentUri(this.databsaeName, this.containerName, this.nextExecutionItemId); ResourceResponse itemResponse = await this.documentClient.ReadDocumentAsync( @@ -61,7 +63,7 @@ public override async Task ExecuteOnceAsync() }; } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) @@ -84,7 +86,7 @@ public override async Task PrepareAsync() if (itemResponse.StatusCode != HttpStatusCode.Created) { - throw new Exception($"Create failed with statuscode: {itemResponse.StatusCode}"); + throw new Exception($"Create failed with status code: {itemResponse.StatusCode}"); } } } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadTExistsV2BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadTExistsV2BenchmarkOperation.cs index fa9cd81c98..7e161f8ffc 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadTExistsV2BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v2/ReadTExistsV2BenchmarkOperation.cs @@ -13,7 +13,7 @@ namespace CosmosBenchmark using Microsoft.Azure.Documents.Client; using Newtonsoft.Json.Linq; - internal class ReadTExistsV2BenchmarkOperation : ReadBenchmarkOperation + internal class ReadTExistsV2BenchmarkOperation : IBenchmarkOperation { private readonly string partitionKeyPath; private readonly Dictionary sampleJObject; @@ -26,6 +26,8 @@ internal class ReadTExistsV2BenchmarkOperation : ReadBenchmarkOperation private readonly DocumentClient documentClient; + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + public ReadTExistsV2BenchmarkOperation( DocumentClient documentClient, string dbName, @@ -42,7 +44,7 @@ public ReadTExistsV2BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public async Task ExecuteOnceAsync() { Uri itemUri = UriFactory.CreateDocumentUri(this.databsaeName, this.containerName, this.nextExecutionItemId); DocumentResponse> itemResponse = await this.documentClient.ReadDocumentAsync>( @@ -62,7 +64,7 @@ public override async Task ExecuteOnceAsync() }; } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) @@ -85,7 +87,7 @@ public override async Task PrepareAsync() if (itemResponse.StatusCode != HttpStatusCode.Created) { - throw new Exception($"Create failed with statuscode: {itemResponse.StatusCode}"); + throw new Exception($"Create failed with status code: {itemResponse.StatusCode}"); } } } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/InsertV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/InsertV3BenchmarkOperation.cs index 81f9da9c87..504148bfda 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/InsertV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/InsertV3BenchmarkOperation.cs @@ -12,7 +12,7 @@ namespace CosmosBenchmark using Newtonsoft.Json; using Newtonsoft.Json.Serialization; - internal class InsertV3BenchmarkOperation : InsertBenchmarkOperation + internal class InsertV3BenchmarkOperation : IBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -37,7 +37,9 @@ public InsertV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Insert; + + public async Task ExecuteOnceAsync() { using (MemoryStream input = JsonHelper.ToStream(this.sampleJObject)) { @@ -60,7 +62,7 @@ public override async Task ExecuteOnceAsync() } } - public override Task PrepareAsync() + public Task PrepareAsync() { string newPartitionKey = Guid.NewGuid().ToString(); this.sampleJObject["id"] = Guid.NewGuid().ToString(); diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs index 5eb8fba252..cd7bc01c1f 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs @@ -11,7 +11,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal abstract class QueryTV3BenchmarkOperation : QueryBenchmarkOperation + internal abstract class QueryTV3BenchmarkOperation : IBenchmarkOperation { protected readonly Container container; protected readonly Dictionary sampleJObject; @@ -31,6 +31,8 @@ internal abstract class QueryTV3BenchmarkOperation : QueryBenchmarkOperation public abstract bool IsPaginationEnabled { get; } public abstract bool IsQueryStream { get; } + public BenchmarkOperationType OperationType => BenchmarkOperationType.Query; + protected string executionItemId = null; protected string executionPartitionKey = null; @@ -55,7 +57,7 @@ public QueryTV3BenchmarkOperation( /// /// /// - public override async Task ExecuteOnceAsync() + public async Task ExecuteOnceAsync() { if (this.IsQueryStream) { @@ -258,7 +260,7 @@ private async Task ExecuteOnceAsyncWithStreamsAndPagination() /// /// /// - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (this.initialized) { @@ -291,7 +293,7 @@ public override async Task PrepareAsync() if (itemResponse.StatusCode != HttpStatusCode.Created) { - throw new Exception($"Create failed with statuscode: {itemResponse.StatusCode}"); + throw new Exception($"Create failed with status code: {itemResponse.StatusCode}"); } } } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadFeedStreamV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadFeedStreamV3BenchmarkOperation.cs index 3917470691..3b9c5cd800 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadFeedStreamV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadFeedStreamV3BenchmarkOperation.cs @@ -11,7 +11,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal class ReadFeedStreamV3BenchmarkOperation : ReadBenchmarkOperation + internal class ReadFeedStreamV3BenchmarkOperation : IBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -39,7 +39,9 @@ public ReadFeedStreamV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task ExecuteOnceAsync() { FeedIterator feedIterator = this.container .GetItemQueryStreamIterator( @@ -50,7 +52,7 @@ public override async Task ExecuteOnceAsync() ResponseMessage feedResponse = await feedIterator.ReadNextAsync(); if (feedResponse.StatusCode != HttpStatusCode.OK) { - throw new Exception($"ReadItem failed wth {feedResponse.StatusCode}"); + throw new Exception($"ReadItem failed with {feedResponse.StatusCode}"); } return new OperationResult() @@ -63,7 +65,7 @@ public override async Task ExecuteOnceAsync() }; } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) @@ -84,7 +86,7 @@ public override async Task PrepareAsync() if (itemResponse.StatusCode != HttpStatusCode.Created) { - throw new Exception($"Create failed with statuscode: {itemResponse.StatusCode}"); + throw new Exception($"Create failed with status code: {itemResponse.StatusCode}"); } } } diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadNotExistsV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadNotExistsV3BenchmarkOperation.cs index fcec5a46fd..1804ea9852 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadNotExistsV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadNotExistsV3BenchmarkOperation.cs @@ -9,7 +9,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal class ReadNotExistsV3BenchmarkOperation : ReadBenchmarkOperation + internal class ReadNotExistsV3BenchmarkOperation : IBenchmarkOperation { private readonly Container container; @@ -32,7 +32,9 @@ public ReadNotExistsV3BenchmarkOperation( this.container = cosmosClient.GetContainer(this.databsaeName, this.containerName); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task ExecuteOnceAsync() { using (ResponseMessage itemResponse = await this.container.ReadItemStreamAsync( this.nextExecutionItemId, @@ -40,7 +42,7 @@ public override async Task ExecuteOnceAsync() { if (itemResponse.StatusCode != HttpStatusCode.NotFound) { - throw new Exception($"ReadItem failed wth {itemResponse.StatusCode}"); + throw new Exception($"ReadItem failed with {itemResponse.StatusCode}"); } return new OperationResult() @@ -54,7 +56,7 @@ public override async Task ExecuteOnceAsync() } } - public override Task PrepareAsync() + public Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsV3BenchmarkOperation.cs index 6695f721b6..fabe8f20bd 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsV3BenchmarkOperation.cs @@ -11,7 +11,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal class ReadStreamExistsV3BenchmarkOperation : ReadBenchmarkOperation + internal class ReadStreamExistsV3BenchmarkOperation : IBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -39,7 +39,9 @@ public ReadStreamExistsV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task ExecuteOnceAsync() { using (ResponseMessage itemResponse = await this.container.ReadItemStreamAsync( this.nextExecutionItemId, @@ -61,7 +63,7 @@ public override async Task ExecuteOnceAsync() } } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsWithDiagnosticsV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsWithDiagnosticsV3BenchmarkOperation.cs index 580b9cd375..74f2ac67f7 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsWithDiagnosticsV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadStreamExistsWithDiagnosticsV3BenchmarkOperation.cs @@ -11,7 +11,7 @@ namespace CosmosBenchmark using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - internal class ReadStreamExistsWithDiagnosticsV3BenchmarkOperation : ReadBenchmarkOperation + internal class ReadStreamExistsWithDiagnosticsV3BenchmarkOperation : IBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -39,7 +39,9 @@ public ReadStreamExistsWithDiagnosticsV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task ExecuteOnceAsync() { using (ResponseMessage itemResponse = await this.container.ReadItemStreamAsync( this.nextExecutionItemId, @@ -47,7 +49,7 @@ public override async Task ExecuteOnceAsync() { if (itemResponse.StatusCode != HttpStatusCode.OK) { - throw new Exception($"ReadItem failed wth {itemResponse.StatusCode}"); + throw new Exception($"ReadItem failed with {itemResponse.StatusCode}"); } string diagnostics = itemResponse.Diagnostics.ToString(); @@ -67,7 +69,7 @@ public override async Task ExecuteOnceAsync() } } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadTExistsV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadTExistsV3BenchmarkOperation.cs index 392a38691e..bb6295356e 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadTExistsV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/ReadTExistsV3BenchmarkOperation.cs @@ -10,9 +10,8 @@ namespace CosmosBenchmark using System.Net; using System.Threading.Tasks; using Microsoft.Azure.Cosmos; - using Newtonsoft.Json.Linq; - internal class ReadTExistsV3BenchmarkOperation : ReadBenchmarkOperation + internal class ReadTExistsV3BenchmarkOperation : IBenchmarkOperation { private readonly Container container; private readonly string partitionKeyPath; @@ -40,14 +39,16 @@ public ReadTExistsV3BenchmarkOperation( this.sampleJObject = JsonHelper.Deserialize>(sampleJson); } - public override async Task ExecuteOnceAsync() + public BenchmarkOperationType OperationType => BenchmarkOperationType.Read; + + public async Task ExecuteOnceAsync() { ItemResponse> itemResponse = await this.container.ReadItemAsync>( this.nextExecutionItemId, new PartitionKey(this.nextExecutionItemPartitionKey)); if (itemResponse.StatusCode != HttpStatusCode.OK) { - throw new Exception($"ReadItem failed wth {itemResponse.StatusCode}"); + throw new Exception($"ReadItem failed with {itemResponse.StatusCode}"); } return new OperationResult() @@ -60,7 +61,7 @@ public override async Task ExecuteOnceAsync() }; } - public override async Task PrepareAsync() + public async Task PrepareAsync() { if (string.IsNullOrEmpty(this.nextExecutionItemId) || string.IsNullOrEmpty(this.nextExecutionItemPartitionKey)) @@ -81,7 +82,7 @@ public override async Task PrepareAsync() if (itemResponse.StatusCode != HttpStatusCode.Created) { - throw new Exception($"Create failed with statuscode: {itemResponse.StatusCode}"); + throw new Exception($"Create failed with status code: {itemResponse.StatusCode}"); } } } From c5880553720e392fa5873d3a2f624e614a362c2f Mon Sep 17 00:00:00 2001 From: Mikhail Lipin Date: Tue, 11 Jul 2023 19:22:23 +0300 Subject: [PATCH 5/5] Restore PrepareAsync to be virtual. --- .../Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs index cd7bc01c1f..f78153034b 100644 --- a/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs +++ b/Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/v3/QueryTV3BenchmarkOperation.cs @@ -260,7 +260,7 @@ private async Task ExecuteOnceAsyncWithStreamsAndPagination() /// /// /// - public async Task PrepareAsync() + public virtual async Task PrepareAsync() { if (this.initialized) {