wwbmmm commented on code in PR #3144:
URL: https://github.com/apache/brpc/pull/3144#discussion_r4571093574
##########
src/brpc/checksum.h:
##########
@@ -42,12 +42,16 @@ struct ChecksumIn {
};
struct ChecksumHandler {
- // checksum `buf'.
- // Returns checksum value
- void (*Compute)(const ChecksumIn& in);
+ // checksum `buf' and store the value in the controller.
+ // Returns true on success. Returns false when the checksum could not be
+ // computed (e.g. GPU memory read failure with GDR); the controller is
+ // left without a checksum value and the caller must fail the RPC instead
+ // of sending data whose checksum was never calculated.
+ bool (*Compute)(const ChecksumIn& in);
Review Comment:
[replied by brpc-oncall robot] `ChecksumHandler` and
`RegisterChecksumHandler()` are part of the public API — `brpc/checksum.h` is
installed and the registration function is exposed for out-of-tree checksum
implementations — so changing `Compute` from `void (*)(const ChecksumIn&)` to
`bool (*)(const ChecksumIn&)` breaks every existing custom handler at compile
time (the struct initializers no longer match), and `ComputeDataChecksum()`'s
void→bool change is a public API change as well. The only goal here is to
detect the GDR GPU-read failure, which can be done without touching the public
signatures: keep `void Compute` and, on failure, have `Crc32cCompute()` leave
the checksum value unset (or mark the controller failed), then let
`ComputeDataChecksum()`/`SerializeRpcMessage()` treat an empty checksum value /
`cntl.Failed()` as failure and abort the RPC; alternatively append a new
optional member (e.g. `ComputeEx`) so existing three-field initializers keep
compiling.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]