fix: add bulkCommit() and BatchWrite protos#231
Conversation
68f60a5 to
93a5c73
Compare
93a5c73 to
dcb4f28
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
BenWhitehead
left a comment
There was a problem hiding this comment.
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.
|
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. |
|
@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? |
BenWhitehead
left a comment
There was a problem hiding this comment.
This is okay to merge to the feature branch, will coordinate at a later time for the feature branches merge to master.
| this.status = status; | ||
| } | ||
|
|
||
| public Timestamp getWriteTime() { |
| * BatchWriteRequests. | ||
| */ | ||
| public final class BatchWriteResult { | ||
| private final Timestamp writeTime; |
| @Test | ||
| public void bulkCommit() throws Exception { | ||
| BatchWriteResponse.Builder response = BatchWriteResponse.newBuilder(); | ||
| response.addWriteResultsBuilder().getUpdateTimeBuilder().setSeconds(0).setNanos(1); |
There was a problem hiding this comment.
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.
| BatchWriteResponse.Builder response = BatchWriteResponse.newBuilder(); | ||
| response.addWriteResultsBuilder().getUpdateTimeBuilder().setSeconds(0).setNanos(1); | ||
| response.addWriteResultsBuilder(); | ||
| response.addStatusBuilder().setCode(0).build(); |
There was a problem hiding this comment.
setCode(0) is the default.
| List<BatchWriteResult> batchWriteResults = batch.bulkCommit().get(); | ||
|
|
||
| assertEquals(Timestamp.ofTimeSecondsAndNanos(0, 1), batchWriteResults.get(0).getWriteTime()); | ||
| assertEquals(Status.OK, batchWriteResults.get(0).getStatus()); |
There was a problem hiding this comment.
Nit (you may ignore): I would feel more natural to compare the status before comparing the time.
23dba2d to
29f0785
Compare
Porting from node.