]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Don't swallow errors in datalog async trim
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 4 Feb 2021 20:48:56 +0000 (15:48 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 29 Mar 2021 16:25:58 +0000 (12:25 -0400)
Typo and misleading indentation.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_datalog.cc

index 2a7033eee6b9ee049cb6940df0e42cdd131f7401..404f7e9a0e5738b8de3838734dbd99cfb9b46ac2 100644 (file)
@@ -799,7 +799,10 @@ int DataLogBackends::trim_entries(int shard_id, std::string_view marker)
     l.unlock();
     auto c = be->gen_id == target_gen ? cursor : be->max_marker();
     r = be->trim(shard_id, c);
-    if (r == -ENODATA && be->gen_id < target_gen) r = 0;
+    if (r == -ENOENT)
+      r = -ENODATA;
+    if (r == -ENODATA && be->gen_id < target_gen)
+      r = 0;
     l.lock();
   };
   return r;
@@ -821,8 +824,8 @@ public:
   const uint64_t tail_gen;
   boost::intrusive_ptr<RGWDataChangesBE> be;
 
-  GenTrim(DataLogBackends* bes, int shard_id, uint64_t target_gen, std::string cursor,
-         uint64_t head_gen, uint64_t tail_gen,
+  GenTrim(DataLogBackends* bes, int shard_id, uint64_t target_gen,
+         std::string cursor, uint64_t head_gen, uint64_t tail_gen,
          boost::intrusive_ptr<RGWDataChangesBE> be,
          lr::AioCompletion* super)
     : Completion(super), bes(bes), shard_id(shard_id), target_gen(target_gen),
@@ -832,8 +835,9 @@ public:
   void handle(Ptr&& p, int r) {
     auto gen_id = be->gen_id;
     be.reset();
-    if (r == -ENOENT) r = -ENODATA;
-    if (r == -ENODATA && gen_id < target_gen) r = 0;
+    if (r == -ENOENT)
+      r = -ENODATA;
+    if (r == -ENODATA && gen_id < target_gen)
       r = 0;
     if (r < 0) {
       complete(std::move(p), r);
@@ -845,7 +849,7 @@ public:
       auto i = bes->upper_bound(gen_id);
       if (i == bes->end() || i->first > target_gen || i->first > head_gen) {
        l.unlock();
-       complete(std::move(p), r);
+       complete(std::move(p), -ENODATA);
        return;
       }
       be = i->second;