-
Notifications
You must be signed in to change notification settings - Fork 74
fix: use sentinel on BulkWriter.delete() #251
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
| 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()); | ||
| } |
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 entire block is just:
Timestamp updateTime = status.isOk() ? Timestamp.fromProto(writeResult.getUpdateTime()) : null;
getUpdateTime() defaults to an empty Timestamp in the Java API.
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. 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.
|
| Status.fromCodeValue(status.getCode()) == Status.OK | ||
| ? Timestamp.fromProto(writeResult.getUpdateTime()) | ||
| : null; | ||
| result.add(new BatchWriteResult(updateTime, Status.fromCodeValue(status.getCode()))); |
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: Duplicate Status.fromCodeValue... from line 701
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.
thanks, done.
Porting from node.
Will add integration tests in separate PR.