Skip to content
New issue

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

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

Already on GitHub? # to your account

Omitting WriteResults for DocumentTransforms #2565

Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Oct 30, 2017

We have to split up a write that contains a ServerTimestamp into two distinct writes. Since the user is unaware of this, we should only return one WriteResult in our response.

This is only relevant for WriteBatches and a port of googleapis/nodejs-firestore#45

I also ran google-java-format on the codebase.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 30, 2017
Copy link
Contributor

@pongad pongad left a comment

Choose a reason for hiding this comment

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

To make sure I understand it right:
If the user makes N writes, we could previously return more than N responses because some writes are split. Now we always return N responses assuming everything succeeds?

@@ -484,7 +484,7 @@ public String updateCallback(Transaction transaction) {
@Test
public void deleteDocument() throws Exception {
doReturn(beginResponse())
.doReturn(commitResponse(0, 0))
.doReturn(commitResponse(2, 0))

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@schmidt-sebastian
Copy link
Contributor Author

To make sure I understand it right:
If the user makes N writes, we could previously return more than N responses because some writes are split. Now we always return N responses assuming everything succeeds?

The server always returns n write responses for n write requests. The problem is that there is no 1 to 1 mapping between user requests and write requests (some user requests might turn into two writes). This PR removes the extra writes, so that the user can correlate its requests to the responses.

@pongad
Copy link
Contributor

pongad commented Nov 7, 2017

I see. That makes sense.

Copy link
Contributor

@pongad pongad left a comment

Choose a reason for hiding this comment

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

LGTM. @garrettjonesgoogle do you want to look too?

@schmidt-sebastian
Copy link
Contributor Author

Garrett, please let me know offline if there are any concerns.

@schmidt-sebastian schmidt-sebastian merged commit e57d4a7 into googleapis:master Nov 7, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants