]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: fix ENODATA handling in CyanStore::get_attrs().
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 27 Aug 2019 20:47:37 +0000 (22:47 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 13 Sep 2019 18:28:10 +0000 (20:28 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/os/cyan_store.cc
src/crimson/os/futurized_store.h
src/crimson/osd/exceptions.h
src/crimson/osd/pg_backend.cc

index 650dcb896ad5bd3acd932149a36a0a0b5aa7353d..06deaaa102eb60a730707eec9d6af41f46356de7 100644 (file)
@@ -218,7 +218,7 @@ seastar::future<ceph::bufferptr> CyanStore::get_attr(CollectionRef ch,
     return seastar::make_ready_future<ceph::bufferptr>(found->second);
   } else {
     return seastar::make_exception_future<ceph::bufferptr>(
-      EnoentException(fmt::format("attr does not exist: {}/{}", oid, name)));
+      EnodataException(fmt::format("attr does not exist: {}/{}", oid, name)));
   }
 }
 
index edd7866dfdef967cd50f25d44f232bc333407db7..3ff9cb0f7a861d4d9bae337c1d6c359dd2dc7968 100644 (file)
@@ -23,6 +23,7 @@ class Transaction;
 class FuturizedStore {
 
 public:
+  // TODO: replace with the ceph::errorator concept
   template <class ConcreteExceptionT>
   class Exception : public std::logic_error {
   public:
@@ -49,6 +50,9 @@ public:
   struct EnoentException : public Exception<EnoentException> {
     using Exception<EnoentException>::Exception;
   };
+  struct EnodataException : public Exception<EnodataException> {
+    using Exception<EnodataException>::Exception;
+  };
   static std::unique_ptr<FuturizedStore> create(const std::string& type,
                                                 const std::string& data);
   FuturizedStore() = default;
index 563cc4e3f532e8d126f967f997bf7b9f09238b41..0d678e372946905b606819ea9393fbf41429262d 100644 (file)
@@ -40,6 +40,10 @@ struct invalid_argument : public error {
   invalid_argument() : error(std::errc::invalid_argument) {}
 };
 
+struct no_message_available : public error {
+  no_message_available() : error(std::errc::no_message_available) {}
+};
+
 // FIXME: error handling
 struct operation_not_supported : public error {
   operation_not_supported()
index b0af08417973a3b12096fb6ab236503aedfd2337..40d109d448ce4a4e472b48109ea96a03130434c4 100644 (file)
@@ -453,6 +453,7 @@ seastar::future<> PGBackend::setxattr(
     name = "_" + aname;
     bp.copy(osd_op.op.xattr.value_len, val);
   }
+  logger().debug("setxattr on obj={} for attr={}", os.oi.soid, name);
 
   txn.setattr(coll->get_cid(), ghobject_t{os.oi.soid}, name, val);
   return seastar::now();
@@ -471,14 +472,18 @@ seastar::future<> PGBackend::getxattr(
     bp.copy(osd_op.op.xattr.name_len, aname);
     name = "_" + aname;
   }
+  logger().debug("getxattr on obj={} for attr={}", os.oi.soid, name);
   return getxattr(os.oi.soid, name).then([&osd_op] (ceph::bufferptr val) {
     osd_op.outdata.clear();
     osd_op.outdata.push_back(std::move(val));
     osd_op.op.xattr.value_len = osd_op.outdata.length();
     //ctx->delta_stats.num_rd_kb += shift_round_up(osd_op.outdata.length(), 10);
   }).handle_exception_type(
-    [] (ceph::os::FuturizedStore::EnoentException& e) {
+    [] (ceph::os::FuturizedStore::EnoentException&) {
       return seastar::make_exception_future<>(ceph::osd::object_not_found{});
+  }).handle_exception_type(
+    [] (ceph::os::FuturizedStore::EnodataException&) {
+      return seastar::make_exception_future<>(ceph::osd::no_message_available{});
   });
   //ctx->delta_stats.num_rd++;
 }