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

Fix/1822 depends on atomicity group id v4 #1831

Merged
merged 1 commit into from Aug 10, 2020

Conversation

KenitoInc
Copy link
Contributor

@KenitoInc KenitoInc commented Jul 1, 2020

Issues

This pull request fixes issue #1822 .

Description

Moved validations from ODataBatchWriter and ODataBatchReader to individual implementations of ODataJsonLightBatchWriter , ODataJsonLightBatchReader, ODataMultipartMixedBatchWriter and ODataMultipartMixedBatchReader

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Additional work necessary

If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.

@KenitoInc KenitoInc marked this pull request as ready for review July 2, 2020 08:39
@KenitoInc KenitoInc added the Ready for review Use this label if a pull request is ready to be reviewed label Jul 2, 2020
if (id != null && !this.requestIdToAtomicGroupId.ContainsKey(id))
{
this.requestIdToAtomicGroupId.Add(id, atomicityGroupId);
}
Copy link
Member

@mikepizzo mikepizzo Jul 10, 2020

Choose a reason for hiding this comment

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

Rather than do an explicit ContainsKey check before calling Add, why not just do:
if (id != null)
{
this.requestIdToAtomicGroupId.TryAdd(id, atomicityGroupId);
} #Resolved

Copy link
Contributor Author

@KenitoInc KenitoInc Jul 14, 2020

Choose a reason for hiding this comment

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

Fixed #Resolved

Copy link
Member

Choose a reason for hiding this comment

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

Should you use TryAdd(id) rather than Add(id) to avoid possible exceptions if the id already exists, or are we asserting that the id doesn't already exist? (same for below)


In reply to: 454179343 [](ancestors = 454179343)

Copy link
Member

Choose a reason for hiding this comment

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

Never mind; I see that you moved to HashSet, which is perfect.


In reply to: 467600534 [](ancestors = 467600534,454179343)

/// for reversed lookup.
/// </summary>
private Dictionary<string, IList<string>> atomicityGroupIdToRequestId = new Dictionary<string, IList<string>>();

/// <summary>
Copy link
Member

@mikepizzo mikepizzo Jul 10, 2020

Choose a reason for hiding this comment

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

Why do you need dictionaries, it looks like you just check to see if the dictionary contains the key, not the relationship between the id and the atomicity group. Can you just use a list? #Resolved

Copy link
Contributor Author

@KenitoInc KenitoInc Jul 14, 2020

Choose a reason for hiding this comment

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

I have changed it to a HashSet. #Resolved

/// Dictionary for keeping track of each atomic group's member request id. This is optimization
/// for reversed lookup.
/// </summary>
private Dictionary<string, IList<string>> atomicityGroupIdToRequestId = new Dictionary<string, IList<string>>();
Copy link
Member

@mikepizzo mikepizzo Jul 10, 2020

Choose a reason for hiding this comment

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

atomicityGroupIdToRequestId [](start = 50, length = 27)

atomicityGroupIdToRequestId [](start = 50, length = 27)

Do you need a separate list for atomicity group versus ids, or can you simply look up to see if the id has already been specified? #Resolved

Copy link
Contributor Author

@KenitoInc KenitoInc Jul 14, 2020

Choose a reason for hiding this comment

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

Fixed #Resolved

Copy link
Member

@mikepizzo mikepizzo left a comment

Choose a reason for hiding this comment

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

See a few comments -- I think we can simplify the tracking of ids.

@KenitoInc KenitoInc requested a review from mikepizzo July 14, 2020 09:47
@KenitoInc KenitoInc force-pushed the fix/1822-DependsOnAtomicityGroupIdV4 branch from 902d05a to 3a628bf Compare July 14, 2020 13:30
Copy link
Member

@mikepizzo mikepizzo left a comment

Choose a reason for hiding this comment

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

:shipit:

@xuzhg xuzhg merged commit 6d9d600 into OData:master Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for review Use this label if a pull request is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants