fix: use sentinel on BulkWriter.delete()#251
Merged
thebrianchen merged 3 commits intobc/bulk-masterfrom Jun 11, 2020
Merged
Conversation
Comment on lines
700
to
713
| Timestamp updateTime = null; | ||
|
|
||
| // Since delete operations currently do not have write times, use a | ||
| // sentinel Timestamp value. | ||
| // TODO(b/158502664): Use actual delete timestamp. | ||
| boolean isSuccessfulDelete = | ||
| !writeResult.hasUpdateTime() | ||
| && Status.fromCodeValue(status.getCode()) == Status.OK; | ||
| Timestamp DELETE_TIMESTAMP_SENTINEL = Timestamp.ofTimeSecondsAndNanos(0, 0); | ||
| if (isSuccessfulDelete) { | ||
| updateTime = DELETE_TIMESTAMP_SENTINEL; | ||
| } else if (writeResult.hasUpdateTime()) { | ||
| updateTime = Timestamp.fromProto(writeResult.getUpdateTime()); | ||
| } |
Contributor
There was a problem hiding this comment.
This entire block is just:
Timestamp updateTime = status.isOk() ? Timestamp.fromProto(writeResult.getUpdateTime()) : null;
getUpdateTime() defaults to an empty Timestamp in the Java API.
Author
There was a problem hiding this comment.
done. It's pretty much just comment changes at this point
Codecov Report
@@ Coverage Diff @@
## bc/bulk-master #251 +/- ##
====================================================
- Coverage 73.72% 73.72% -0.01%
Complexity 1087 1087
====================================================
Files 67 67
Lines 5866 5865 -1
Branches 642 642
====================================================
- Hits 4325 4324 -1
Misses 1341 1341
Partials 200 200
Continue to review full report at Codecov.
|
BenWhitehead
approved these changes
Jun 11, 2020
| Status.fromCodeValue(status.getCode()) == Status.OK | ||
| ? Timestamp.fromProto(writeResult.getUpdateTime()) | ||
| : null; | ||
| result.add(new BatchWriteResult(updateTime, Status.fromCodeValue(status.getCode()))); |
Collaborator
There was a problem hiding this comment.
nit: Duplicate Status.fromCodeValue... from line 701
schmidt-sebastian
approved these changes
Jun 11, 2020
BenWhitehead
pushed a commit
that referenced
this pull request
Aug 7, 2020
BenWhitehead
pushed a commit
that referenced
this pull request
Aug 7, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Porting from node.
Will add integration tests in separate PR.