Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
09468d0
Add README documentation for programatic Setup (#241)
Arkatufus Aug 29, 2022
445c497
Bump Microsoft.NET.Test.Sdk from 17.3.0 to 17.3.1 (#242)
dependabot[bot] Aug 30, 2022
db3c2c6
Bump AkkaVersion from 1.4.40 to 1.4.41 (#243)
dependabot[bot] Sep 7, 2022
2994926
Bump Docker.DotNet from 3.125.10 to 3.125.11 (#244)
dependabot[bot] Sep 7, 2022
20f2168
Bump Akka.Persistence.Hosting from 0.4.2 to 0.4.3 (#245)
dependabot[bot] Sep 12, 2022
51d3142
Bump Docker.DotNet from 3.125.11 to 3.125.12 (#246)
dependabot[bot] Sep 19, 2022
7d73823
Bump Azure.Identity from 1.6.1 to 1.7.0 (#247)
dependabot[bot] Sep 20, 2022
c22a034
Cleanup all async operation during shutdown (#249)
Arkatufus Sep 23, 2022
d1baecf
Migrate DefaultAzureCredential to TokenCredential (#250)
Arkatufus Sep 23, 2022
ac47852
Re-add chunked transaction batching support (#254)
Arkatufus Sep 27, 2022
dad8e68
Add chunked transaction operation documentation
Arkatufus Sep 27, 2022
e8f0f53
Merge pull request #256 from Arkatufus/chunk_documentation
Arkatufus Sep 27, 2022
5fe73f9
Bump AkkaVersion from 1.4.41 to 1.4.42
dependabot[bot] Sep 27, 2022
4f5147f
Merge pull request #253 from petabridge/dependabot/nuget/AkkaVersion-…
Arkatufus Sep 27, 2022
837a0e3
Bump AkkaVersion from 1.4.41 to 1.4.43
Arkatufus Sep 27, 2022
205f2db
Merge remote-tracking branch 'upstream/dev' into AkkaVersion_1.4.43
Arkatufus Sep 27, 2022
2cc13df
Merge pull request #257 from Arkatufus/AkkaVersion_1.4.43
Arkatufus Sep 27, 2022
95ef401
Update RELEASE_NOTES.md for 0.9.2 release
Arkatufus Sep 27, 2022
2b16e90
Merge pull request #258 from Arkatufus/Update_RELEASE_NOTES_for_0.9.2
Arkatufus Sep 27, 2022
fb56397
Add xunit.runner.json
Arkatufus Sep 27, 2022
98dede2
Merge pull request #260 from Arkatufus/add_xunit.runner.json
Arkatufus Sep 27, 2022
b942ec4
Bump Microsoft.NET.Test.Sdk from 17.3.1 to 17.3.2
dependabot[bot] Sep 27, 2022
6d8ec7f
Merge pull request #252 from petabridge/dependabot/nuget/Microsoft.NE…
Arkatufus Sep 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add chunked transaction operation documentation
  • Loading branch information
Arkatufus committed Sep 27, 2022
commit dad8e68e318bb6612c458eab626acae00b570023
13 changes: 13 additions & 0 deletions src/Akka.Persistence.Azure/CloudTableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ public static class CloudTableExtensions
{
private const int MaxBatchSize = 100;

/// <summary>
/// <para>
/// Execute a batch transaction to the service. This method automatically chunks the batch request into chunks
/// of 100 items if the batch size is greater than 100.
/// </para>
/// <b>NOTE</b>: This does mean that sending more than 100 items will break atomicity, there is no guarantee
/// that all items in the batch will be executed successfully.
/// </summary>
/// <param name="table">The Azure table client</param>
/// <param name="batch">The list of <see cref="TableTransactionAction"/> items to be sent to the service</param>
/// <param name="token">Cancellation token</param>
/// <returns>List of <see cref="Response"/> for each items</returns>
// TODO Replace this with real transactional execution if Azure Table Storage supports it in the future.
public static async Task<IReadOnlyList<Response>> ExecuteBatchAsLimitedBatches(
this TableClient table,
List<TableTransactionAction> batch,
Expand Down
24 changes: 24 additions & 0 deletions src/Akka.Persistence.Azure/Journal/AzureTableStorageJournal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ protected override async Task DeleteMessagesToAsync(string persistenceId, long t
else
nextTask = null;

// ** Intentional behaviour **
// Send the batch as a chunk of 100 items. This is intentional because Azure Table Storage
// does not support transaction with more than 100 entries.
//
// ExecuteBatchAsLimitedBatches breaks atomicity on any transaction/batch write operations with more than
// 100 entries.
var response = await Table.ExecuteBatchAsLimitedBatches(currentPage.Values
.Select(entity => new TableTransactionAction(TableTransactionActionType.Delete, entity)).ToList(), _shutdownCts.Token);

Expand Down Expand Up @@ -370,6 +376,12 @@ protected override async Task<IImmutableList<Exception>> WriteMessagesAsync(IEnu
if (_log.IsDebugEnabled && _settings.VerboseLogging)
_log.Debug("Attempting to write batch of {0} messages to Azure storage", batchItems.Count);

// ** Intentional behaviour **
// Send the batch as a chunk of 100 items. This is intentional because Azure Table Storage
// does not support transaction with more than 100 entries.
//
// ExecuteBatchAsLimitedBatches breaks atomicity on any transaction/batch write operations with more than
// 100 entries.
var response = await Table.ExecuteBatchAsLimitedBatches(batchItems, _shutdownCts.Token);
if (_log.IsDebugEnabled && _settings.VerboseLogging)
{
Expand Down Expand Up @@ -400,6 +412,12 @@ protected override async Task<IImmutableList<Exception>> WriteMessagesAsync(IEnu
new AllPersistenceIdsEntry(PartitionKeyEscapeHelper.Escape(item.Key)).WriteEntity()));
}

// ** Intentional behaviour **
// Send the batch as a chunk of 100 items. This is intentional because Azure Table Storage
// does not support transaction with more than 100 entries.
//
// ExecuteBatchAsLimitedBatches breaks atomicity on any transaction/batch write operations with more than
// 100 entries.
var allPersistenceResponse = await Table.ExecuteBatchAsLimitedBatches(allPersistenceIdsBatch, _shutdownCts.Token);

if (_log.IsDebugEnabled && _settings.VerboseLogging)
Expand All @@ -422,6 +440,12 @@ protected override async Task<IImmutableList<Exception>> WriteMessagesAsync(IEnu
eventTagsBatch.Add(new TableTransactionAction(TableTransactionActionType.UpsertReplace, item.WriteEntity()));
}

// ** Intentional behaviour **
// Send the batch as a chunk of 100 items. This is intentional because Azure Table Storage
// does not support transaction with more than 100 entries.
//
// ExecuteBatchAsLimitedBatches breaks atomicity on any transaction/batch write operations with more than
// 100 entries.
var eventTagsResponse = await Table.ExecuteBatchAsLimitedBatches(eventTagsBatch, _shutdownCts.Token);

if (_log.IsDebugEnabled && _settings.VerboseLogging)
Expand Down