deardeng commented on code in PR #69620:
URL: https://github.com/apache/doris/pull/69620#discussion_r4400653904


##########
be/src/cloud/cloud_internal_service.cpp:
##########
@@ -746,14 +746,101 @@ Status handle_peer_file_cache_block_request(const 
PFetchPeerDataRequest* request
     const bool do_fill = request->has_request_cache_fill() && 
request->request_cache_fill() &&
                          config::enable_peer_server_cache_fill;
 
+    // NOT_FOUND means this peer cannot serve the block now; the client 
rotates the candidate
+    // instead of counting an RPC failure.
+    auto not_found = [&](const std::string& msg) {
+        g_file_cache_get_by_peer_failed_num << 1;
+        g_file_cache_get_by_peer_not_downloaded_block_num << 1;
+        LOG(WARNING) << msg;
+        response->mutable_status()->add_error_msgs(msg);
+        response->mutable_status()->set_status_code(TStatusCode::NOT_FOUND);
+        return Status::NotFound<false>(msg);
+    };
+
+    auto serve_block = [&](const CacheBlockReqest& cb_req, io::FileBlockSPtr& 
fb) -> Status {

Review Comment:
   Done. Extracted the lambdas into serve_peer_cache_block() and 
reject_peer_block_not_found(); the handler now passes the request, block and 
response attachment explicitly and keeps the response_blocks count itself.



-- 
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]

Reply via email to