afterincomparableyum commented on code in PR #3605:
URL: https://github.com/apache/celeborn/pull/3605#discussion_r2866939683


##########
cpp/celeborn/client/reader/CelebornInputStream.cpp:
##########
@@ -169,11 +171,61 @@ bool CelebornInputStream::moveToNextChunk() {
 
 std::unique_ptr<memory::ReadOnlyByteBuffer>
 CelebornInputStream::getNextChunk() {
-  // TODO: support the failure retrying, including excluding the failed
-  // location, open a reader to read from the location's peer.
-  auto chunk = currReader_->next();
-  verifyChunk(chunk);
-  return std::move(chunk);
+  while (fetchChunkRetryCnt_ < fetchChunkMaxRetry_) {
+    try {
+      if (isExcluded(currReader_->getLocation())) {
+        CELEBORN_FAIL(
+            "Fetch data from excluded worker! {}",
+            currReader_->getLocation().hostAndFetchPort());
+      }
+      if (!currReader_->hasNext()) {
+        return nullptr;
+      }
+      auto chunk = currReader_->next();
+      verifyChunk(chunk);
+      return std::move(chunk);
+    } catch (const std::exception& e) {
+      auto failedLocation = currReader_->getLocation();
+      shuffleClient_->excludeFailedFetchLocation(
+          failedLocation.hostAndFetchPort(), e);
+      fetchChunkRetryCnt_++;
+      currReader_ = nullptr;
+
+      if (fetchChunkRetryCnt_ == fetchChunkMaxRetry_) {
+        LOG(WARNING) << "Fetch chunk fail exceeds max retry "
+                     << fetchChunkRetryCnt_ << ". Error: " << e.what();
+        throw utils::CelebornRuntimeError(

Review Comment:
   I will change it to use CELEBORN_FAIL, thank you for catching this. 



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

Reply via email to