]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: apply errorator along the read path, part 2.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 13 Sep 2019 16:01:59 +0000 (18:01 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 20 Nov 2019 19:36:16 +0000 (20:36 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/ec_backend.cc
src/crimson/osd/ec_backend.h
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h
src/crimson/osd/replicated_backend.cc
src/crimson/osd/replicated_backend.h

index 5b4db3c1d9c8278b6dd96893e8f3bf48ddb931ce..911dc250e8a09df72d5917cac48ad63a38f9787a 100644 (file)
@@ -12,10 +12,11 @@ ECBackend::ECBackend(shard_id_t shard,
   // todo
 }
 
-seastar::future<bufferlist> ECBackend::_read(const hobject_t& hoid,
-                                             uint64_t off,
-                                             uint64_t len,
-                                             uint32_t flags)
+ECBackend::ll_read_errorator::future<ceph::bufferlist>
+ECBackend::_read(const hobject_t& hoid,
+                 const uint64_t off,
+                 const uint64_t len,
+                 const uint32_t flags)
 {
   // todo
   return seastar::make_ready_future<bufferlist>();
index 31c39e93f7796ccbeed4f27d947787b07ad2a062..c7548de0749ab053ed0c57666ac22e3b4bd5d56b 100644 (file)
@@ -18,10 +18,10 @@ public:
            const ec_profile_t& ec_profile,
            uint64_t stripe_width);
 private:
-  seastar::future<ceph::bufferlist> _read(const hobject_t& hoid,
-                                         uint64_t off,
-                                         uint64_t len,
-                                         uint32_t flags) override;
+  ll_read_errorator::future<ceph::bufferlist> _read(const hobject_t& hoid,
+                                                    uint64_t off,
+                                                    uint64_t len,
+                                                    uint32_t flags) override;
   seastar::future<crimson::osd::acked_peers_t>
   _submit_transaction(std::set<pg_shard_t>&& pg_shards,
                      const hobject_t& hoid,
index 864bf77a57a13d8f8fd029aab54f7b00ee60ed2b..43614732c292b12968039a7cbca2735c9b258587 100644 (file)
@@ -249,14 +249,14 @@ seastar::future<bufferlist> PGBackend::read(const object_info_t& oi,
     // read size was trimmed to zero and it is expected to do nothing,
     return seastar::make_ready_future<bufferlist>();
   }
-  return _read(oi.soid, offset, length, flags).then(
+  return _read(oi.soid, offset, length, flags).safe_then(
     [&oi](auto&& bl) {
       if (const bool is_fine = _read_verify_data(oi, bl); is_fine) {
         return seastar::make_ready_future<bufferlist>(std::move(bl));
       } else {
         throw crimson::osd::object_corrupted{};
       }
-    });
+    }, ll_read_errorator::throw_as_runtime_error{});
 }
 
 seastar::future<> PGBackend::stat(
index 6973236bcd894d6d0a5432d7150a43deb0c0452d..09d8ca165a148af80ad9e663f173abdd71a17450 100644 (file)
@@ -110,6 +110,8 @@ public:
   virtual void got_rep_op_reply(const MOSDRepOpReply&) {}
 
 protected:
+  // low-level read errorator
+  using ll_read_errorator = ceph::os::FuturizedStore::read_errorator;
   const shard_id_t shard;
   CollectionRef coll;
   crimson::os::FuturizedStore* store;
@@ -120,10 +122,11 @@ private:
   seastar::future<cached_ss_t> _load_ss(const hobject_t& oid);
   SharedLRU<hobject_t, ObjectState> os_cache;
   seastar::future<cached_os_t> _load_os(const hobject_t& oid);
-  virtual seastar::future<bufferlist> _read(const hobject_t& hoid,
-                                           size_t offset,
-                                           size_t length,
-                                           uint32_t flags) = 0;
+  virtual ll_read_errorator::future<ceph::bufferlist> _read(
+    const hobject_t& hoid,
+    size_t offset,
+    size_t length,
+    uint32_t flags) = 0;
   bool maybe_create_new_object(ObjectState& os, ceph::os::Transaction& txn);
   virtual seastar::future<crimson::osd::acked_peers_t>
   _submit_transaction(std::set<pg_shard_t>&& pg_shards,
index 1955049bd4c4ea6c65fe51823636b60bfcbc88fa..71ae5165f575ad583862c62177cea50dd6b04e05 100644 (file)
@@ -23,15 +23,13 @@ ReplicatedBackend::ReplicatedBackend(pg_t pgid,
     shard_services{shard_services}
 {}
 
-seastar::future<bufferlist> ReplicatedBackend::_read(const hobject_t& hoid,
-                                                     uint64_t off,
-                                                     uint64_t len,
-                                                     uint32_t flags)
+ReplicatedBackend::ll_read_errorator::future<ceph::bufferlist>
+ReplicatedBackend::_read(const hobject_t& hoid,
+                         const uint64_t off,
+                         const uint64_t len,
+                         const uint32_t flags)
 {
-  using read_errorator = ceph::os::FuturizedStore::read_errorator;
-  return store->read(coll, ghobject_t{hoid}, off, len, flags).safe_then(
-    [] (auto&& bl) { return bl; },
-    read_errorator::throw_as_runtime_error{});
+  return store->read(coll, ghobject_t{hoid}, off, len, flags);
 }
 
 seastar::future<crimson::osd::acked_peers_t>
index 03f410c372aa39a48d05292f365cf5cfce883118..c61d2b88d0ef4842cef385b8c3615c4e31af585b 100644 (file)
@@ -23,10 +23,10 @@ public:
                    crimson::osd::ShardServices& shard_services);
   void got_rep_op_reply(const MOSDRepOpReply& reply) final;
 private:
-  seastar::future<ceph::bufferlist> _read(const hobject_t& hoid,
-                                         uint64_t off,
-                                         uint64_t len,
-                                         uint32_t flags) override;
+  ll_read_errorator::future<ceph::bufferlist> _read(const hobject_t& hoid,
+                                                   uint64_t off,
+                                                   uint64_t len,
+                                                   uint32_t flags) override;
   seastar::future<crimson::osd::acked_peers_t>
   _submit_transaction(std::set<pg_shard_t>&& pg_shards,
                      const hobject_t& hoid,