Skip to content

Conversation

@thebrianchen
Copy link

Porting from node.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 28, 2020
@thebrianchen thebrianchen self-assigned this May 28, 2020
@codecov
Copy link

codecov bot commented May 28, 2020

Codecov Report

Merging #231 into bc/bulk-master will increase coverage by 0.61%.
The diff coverage is 83.68%.

Impacted file tree graph

@@                 Coverage Diff                  @@
##             bc/bulk-master     #231      +/-   ##
====================================================
+ Coverage             73.01%   73.62%   +0.61%     
- Complexity             1024     1048      +24     
====================================================
  Files                    64       65       +1     
  Lines                  5443     5650     +207     
  Branches                620      622       +2     
====================================================
+ Hits                   3974     4160     +186     
- Misses                 1271     1296      +25     
+ Partials                198      194       -4     
Impacted Files Coverage Δ Complexity Δ
...oogle/cloud/firestore/spi/v1/GrpcFirestoreRpc.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...gle/cloud/firestore/v1/FirestoreAdminSettings.java 13.20% <0.00%> (-2.35%) 2.00 <0.00> (ø)
...m/google/cloud/firestore/v1/FirestoreSettings.java 16.36% <0.00%> (-0.62%) 4.00 <0.00> (ø)
...le/cloud/firestore/v1/stub/FirestoreAdminStub.java 5.88% <0.00%> (-2.46%) 1.00 <0.00> (ø)
.../google/cloud/firestore/v1/stub/FirestoreStub.java 5.88% <0.00%> (-0.37%) 1.00 <0.00> (ø)
...gle/cloud/firestore/v1beta1/FirestoreSettings.java 13.20% <0.00%> (ø) 2.00 <0.00> (ø)
...le/cloud/firestore/v1beta1/stub/FirestoreStub.java 6.25% <0.00%> (ø) 1.00 <0.00> (ø)
...oogle/cloud/firestore/v1/FirestoreAdminClient.java 57.46% <50.00%> (-2.38%) 38.00 <23.00> (ø)
.../firestore/v1beta1/stub/FirestoreStubSettings.java 82.35% <79.68%> (ø) 23.00 <5.00> (ø)
...cloud/firestore/v1/stub/FirestoreStubSettings.java 82.60% <90.00%> (+0.25%) 24.00 <1.00> (+1.00)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b078213...7363e48. Read the comment docs.

Copy link
Collaborator

@BenWhitehead BenWhitehead left a comment

Choose a reason for hiding this comment

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

We'll need to wait on merging this until the protos come from synth and googleapis otherwise these new files will be removed. We can get it all fixed up and read to merge once they are available, but we don't want to merge this until then.

@BenWhitehead BenWhitehead added the status: blocked Resolving the issue is dependent on other work. label May 28, 2020
@BenWhitehead
Copy link
Collaborator

The main change adding the buildwriter stuff looks okay to me, but I'm leaving my "Requires changes" review status until we can get the proto issues resolved in master.

@thebrianchen
Copy link
Author

@BenWhitehead I'm trying to merge this into a separate branch (not master) that I plan on using to port BulkWriter into. Is it feasible to develop on a separate branch and then try to merge into master once the proto issues are resolved?

Copy link
Collaborator

@BenWhitehead BenWhitehead left a comment

Choose a reason for hiding this comment

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

This is okay to merge to the feature branch, will coordinate at a later time for the feature branches merge to master.

@thebrianchen thebrianchen removed the status: blocked Resolving the issue is dependent on other work. label May 29, 2020
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

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

LGTM

this.status = status;
}

public Timestamp getWriteTime() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add @Nullable.

Copy link
Author

Choose a reason for hiding this comment

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

done.

* BatchWriteRequests.
*/
public final class BatchWriteResult {
private final Timestamp writeTime;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add @Nullable.

Copy link
Author

Choose a reason for hiding this comment

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

done.

@Test
public void bulkCommit() throws Exception {
BatchWriteResponse.Builder response = BatchWriteResponse.newBuilder();
response.addWriteResultsBuilder().getUpdateTimeBuilder().setSeconds(0).setNanos(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is technically missing one extra call to addWriteResultsBuilder() (with not update time).

You can also drop the call to setSeconds(0) since it is the default value.

Copy link
Author

Choose a reason for hiding this comment

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

done.

BatchWriteResponse.Builder response = BatchWriteResponse.newBuilder();
response.addWriteResultsBuilder().getUpdateTimeBuilder().setSeconds(0).setNanos(1);
response.addWriteResultsBuilder();
response.addStatusBuilder().setCode(0).build();
Copy link
Contributor

Choose a reason for hiding this comment

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

setCode(0) is the default.

Copy link
Author

Choose a reason for hiding this comment

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

removed.

List<BatchWriteResult> batchWriteResults = batch.bulkCommit().get();

assertEquals(Timestamp.ofTimeSecondsAndNanos(0, 1), batchWriteResults.get(0).getWriteTime());
assertEquals(Status.OK, batchWriteResults.get(0).getStatus());
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit (you may ignore): I would feel more natural to compare the status before comparing the time.

Copy link
Author

Choose a reason for hiding this comment

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

makes sense -- flipped.

@BenWhitehead BenWhitehead added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 1, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 1, 2020
@thebrianchen thebrianchen merged commit b60ce7f into bc/bulk-master Jun 1, 2020
@thebrianchen thebrianchen deleted the bc/bulk-commit branch June 1, 2020 22:56
BenWhitehead pushed a commit that referenced this pull request Aug 7, 2020
BenWhitehead added a commit that referenced this pull request Aug 7, 2020
BenWhitehead pushed a commit that referenced this pull request Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

5 participants