]> git-server-git.apps.pok.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, 5 Apr 2021 17:47:58 +0000 (13:47 -0400)
Typo and misleading indentation.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
(cherry picked from commit e97de55f46bbe67b523abfb4c30c50f1547f2601)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_datalog.cc

index 1db5eb86d62e1c312b64d6fdf2a931178b84ec4d..0b68c45a13e8d2a475b03dee6c3cbf108697e735 100644 (file)
@@ -798,7 +798,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;
@@ -820,8 +823,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),
@@ -831,8 +834,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);
@@ -844,7 +848,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;