-
Notifications
You must be signed in to change notification settings - Fork 75
fix: add bulkCommit() and BatchWrite protos #231
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
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.
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.
|
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.
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.
schmidt-sebastian
left a comment
There was a problem hiding this 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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @Nullable.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @Nullable.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense -- flipped.
23dba2d to
29f0785
Compare
Porting from node.