]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: drop pending ops when pg interval changes
authorKefu Chai <kchai@redhat.com>
Mon, 22 Feb 2021 07:58:14 +0000 (15:58 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 23 Feb 2021 06:54:54 +0000 (14:54 +0800)
fullfill the promises of pending ops when pg interval changes, so
we can drop them if the primary osd is changed as well.

note, this behavior depends on interruptable future.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd_operation_sequencer.h
src/crimson/osd/osd_operations/client_request.cc

index 3ce9d82827ee9d9e9ae5cd92a778713cdf98d157..86662e5108b2da6765564e7947edce321b4a61e4 100644 (file)
@@ -61,9 +61,13 @@ public:
     });
   }
 
-  void finish_op(OpRef& op, const spg_t& pgid) {
+  void finish_op(OpRef& op, const spg_t& pgid, bool interrutped) {
     assert(op->pos);
-    pg_ops.at(pgid).erase(*(op->pos));
+    auto curr_op_pos = *(op->pos);
+    if (interrutped) {
+      curr_op_pos->second.set_value();
+    }
+    pg_ops.at(pgid).erase(curr_op_pos);
   }
 private:
   std::map<spg_t, std::map<OpRef, seastar::promise<>, OperationComparator<T>>> pg_ops;
index c1542564224a65da9da04cc1d4b864ff57d106b6..2642150d4e60018ae4f564faa63607c2cc52f400 100644 (file)
@@ -106,17 +106,19 @@ seastar::future<> ClientRequest::start()
            }
          });
        }).then([this, opref, pgref]() mutable {
-         ors.finish_op(opref, pgref->get_pgid());
+         ors.finish_op(opref, pgref->get_pgid(), false);
          return seastar::stop_iteration::yes;
-       });
-      }).handle_exception_type([](crimson::common::actingset_changed& e) {
-       if (e.is_primary()) {
-         logger().debug("operation restart, acting set changed");
-         return seastar::stop_iteration::no;
-       } else {
-         logger().debug("operation abort, up primary changed");
-         return seastar::stop_iteration::yes;
-       }
+        }).handle_exception_type(
+          [opref, pgref, this](crimson::common::actingset_changed& e) mutable {
+          if (e.is_primary()) {
+            logger().debug("operation restart, acting set changed");
+            return seastar::stop_iteration::no;
+          } else {
+            ors.finish_op(opref, pgref->get_pgid(), true);
+            logger().debug("operation abort, up primary changed");
+            return seastar::stop_iteration::yes;
+          }
+        });
       });
     });
   });