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 : concurrent update #392

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ayshiff
Copy link

@ayshiff ayshiff commented Apr 2, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Closes #259

Concurrent updates don't seem to work well when we process two updates at the same time with same PartitionKey but different RowKey.

What is the new behavior?

This is still in Draft because I need to do more research about the current behavior and I'd like to add tests.

As mentioned in the issue, we could replace replaceEntity with mergeEntity.

I don't know if this problem comes from replaceEntity or if it come from concurrent updates.

We could maybe fix the problem by keeping replaceEntity and using etag to do something like this:

replaceEntity<T>(table: string, entityDescriptor: T, options?: any): Promise<azure.TableService.EntityMetadata> {
  return new Promise((resolve, reject) => {
    const entityEtag = entityDescriptor['.metadata'].etag
    this.tableServiceInstance.replaceEntity<T>(table, entityDescriptor, options, (error, result) => {
      if (error) {
        this.printError(error);
        reject(error);
      }
      result['.metadata'].etag = entityEtag;
      resolve(result);
    });
  });
}

I would like to have your opinion on this 👍

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure table : concurrent update strange behavior
1 participant