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

Null Value holder change across collection cache and address cache layer #6312

Merged

Conversation

kushagraThapar
Copy link
Member

@kushagraThapar kushagraThapar commented Nov 13, 2019

…d Mono.empty() and instead used ValueHolder<>(null)
@kushagraThapar
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kirankumarkolli kirankumarkolli added this to the [2019] December milestone Nov 13, 2019
@kushagraThapar
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kushagraThapar
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kushagraThapar
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kushagraThapar
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

collectionResourceId,
null,
() -> this.getByRidAsync(collectionResourceId, properties));
return async.map(Utils.ValueHolder::new);
Copy link
Contributor

Choose a reason for hiding this comment

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

async.map(Utils.ValueHolder::new) seems odd.

If async Mono may return a null value, then by the time the follow has reached map(Utils.ValueHolder::new); Mono will explode.

if async Mono can never return a null value, then why doing async.map(Utils.ValueHolder::new); at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, but async Mono can never return a null value.
The reason for transforming the the async value to Utils.ValueHolder is because of the fact that whoever calls this method also returns null values in some other cases.
If we don't do the transformation here, we will have to do the transformation at the caller level, and there are multiple callers, so that will be code duplication.
So in my opinion it is better to do the transformation at one place than everywhere else.
The same comment applies to below comments as well.


return Mono.error(err);
});
.map(Utils.ValueHolder::new)
Copy link
Contributor

Choose a reason for hiding this comment

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

if the upstream can generate null, the upstream Mono will explode before reaching .map(Utils.ValueHolder::new)

if the upstream cannot generate null value then why adding this transformation here in the first place?

collectionRid,
null,
() -> getRoutingMapForCollectionAsync(collectionRid, null, properties));
() -> getRoutingMapForCollectionAsync(collectionRid, null, properties)).map(Utils.ValueHolder::new);
Copy link
Contributor

Choose a reason for hiding this comment

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

if the upstream can generate null, the upstream Mono will explode before reaching .map(Utils.ValueHolder::new)

if the upstream cannot generate null value then why adding this transformation here in the first place?

Copy link
Contributor

@moderakh moderakh left a comment

Choose a reason for hiding this comment

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

@kushagraThapar we are merging this PR in the interest of time. The comments on this PR needs to be addressed as soon as possible as a priority immediately after the release.

@moderakh moderakh merged commit c43b741 into Azure:feature/cosmos/v4 Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants