Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure table transactional storage for distributed TM #4566

Conversation

sebastianburckhardt
Copy link
Contributor

New implementation for Azure table transactional storage for distributed TM.
Supports arbitrarily sized batches.

Passes existing transactions tests (NOTE: fails on devstorage, must use actual Azure table).
Testing is somewhat incomplete, we still need more tests to exercise all the recovery situations.

existing.TransactionTimestamp = s.TimeStamp;
existing.TransactionManager = s.TransactionManager;
existing.SetState(s.State, this.jsonSettings);
batchOperation.Replace(existing);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what conditions would a prepared state change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the prepared states are indexed by sequence id (1,2,3,4...). These sequence ids serve as the row key in the table. When a transaction is aborted, the same sequence is reused by a different transaction.

}

// third, persist metadata and commit position
key.Metadata = metadata;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the key serves as a synchronizer, to prevent modification by multiple grains under edge conditions, like duplicate activations or deployments. Every batch write needs to include the key, even if the key values don't change.

{
public static string MakeRowKey(long sequenceId)
{
return sequenceId.ToString("x16");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please prefix rowkey and use {RKPrefix} to KRPrefix~ range pattern for min max rowkey. This is a tested pattern we're trying to standardize on for maintainability reasons.

this.logger = logger;
}

public async Task<TransactionalStorageLoadResponse<TState>> Load(string stateName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

statename should probably be used from the interfaces calls (load, store)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't prefer including statename... cleaner to specify it in the factory, which eliminates the ugly ConcurrentDictionary inside the provider.

I actually thought you already came to the same conclusion in #4538 - you removed statename from ITransactionalStateStorage, and removed the ConcurrentDictionary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I did not consistently update my code to reflect the latest pattern. Will do that.

var enumerator = batchOperation.GetEnumerator();
while (enumerator.MoveNext())
{
portion.Add(enumerator.Current);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nifty. I didn't know you could move operations from batch to batch! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. But I'll have to rewrite this part to make it easier to add the key to each batch.

@jason-bragg jason-bragg merged commit 2b17fcf into dotnet:master May 8, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants