]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: set push future an exception when there are errors during pushing
authorXuehan Xu <xxhdx1985126@gmail.com>
Wed, 9 Sep 2020 04:36:18 +0000 (12:36 +0800)
committerXuehan Xu <xxhdx1985126@gmail.com>
Wed, 9 Sep 2020 05:15:44 +0000 (13:15 +0800)
Fixes: https://tracker.ceph.com/issues/47357
Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
src/crimson/osd/recovery_backend.h
src/crimson/osd/replicated_recovery_backend.cc

index 20c469e0c0d6f6f720f033454e2dd53fd7b9e825..b9d63c1d04172f102059d7f0acfaf110b333124d 100644 (file)
@@ -152,6 +152,9 @@ protected:
     void set_pulled() {
       pulled.set_value();
     }
+    void set_push_failed(pg_shard_t shard, std::exception_ptr e) {
+      pushes.at(shard).set_exception(e);
+    }
     void interrupt(const std::string& why) {
       readable.set_exception(std::system_error(
            std::make_error_code(std::errc::interrupted), why));
index e8973fe7a0f428f72bc2949c577633fbe1c2b698..d866f4e393e39f8d6a15eabae981884f544ace64 100644 (file)
@@ -62,25 +62,24 @@ seastar::future<> ReplicatedRecoveryBackend::recover_object(
       });
     }).then([this, soid] {
       auto& recovery = recovering.at(soid);
-      bool error = recovery.pi->recovery_progress.error;
-      if (!error) {
-        auto push_info = recovery.pushing.begin();
-        object_stat_sum_t stat = {};
-        if (push_info != recovery.pushing.end()) {
-          stat = push_info->second.stat;
-        } else {
-          // no push happened, take pull_info's stat
-          stat = recovery.pi->stat;
-        }
-        pg.get_recovery_handler()->on_global_recover(soid, stat, false);
-        return seastar::make_ready_future<>();
+      auto push_info = recovery.pushing.begin();
+      object_stat_sum_t stat = {};
+      if (push_info != recovery.pushing.end()) {
+       stat = push_info->second.stat;
       } else {
-       if (recovery.obc)
-         recovery.obc->drop_recovery_read();
-       recovering.erase(soid);
-       return seastar::make_exception_future<>(
-           std::runtime_error(fmt::format("Errors during pushing for {}", soid)));
+       // no push happened, take pull_info's stat
+       assert(recovery.pi);
+       stat = recovery.pi->stat;
       }
+      pg.get_recovery_handler()->on_global_recover(soid, stat, false);
+      return seastar::make_ready_future<>();
+    }).handle_exception([this, soid](auto e) {
+      auto& recovery = recovering.at(soid);
+      if (recovery.obc)
+       recovery.obc->drop_recovery_read();
+      recovering.erase(soid);
+      return seastar::make_exception_future<>(
+         std::runtime_error(fmt::format("Errors during pushing for {}", soid)));
     });
   });
 }
@@ -865,7 +864,7 @@ seastar::future<bool> ReplicatedRecoveryBackend::_handle_push_reply(
       return seastar::make_ready_future<bool>(true);
     }().handle_exception([recovering_iter, &pi, peer] (auto e) {
       pi.recovery_progress.error = true;
-      recovering_iter->second.set_pushed(peer);
+      recovering_iter->second.set_push_failed(peer, e);
       return seastar::make_ready_future<bool>(true);
     });
   }