]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/test: make use of maybe_flush() in the backfill testing.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 1 Dec 2020 21:57:15 +0000 (22:57 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 8 Dec 2020 11:05:15 +0000 (12:05 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/test/crimson/test_backfill.cc

index f196ee9c69d99ff1228adf30a8c9c1f5be4b3f93..0c5b26379eb3d62d50fe2bfa2513cd5c661bf8be 100644 (file)
@@ -100,7 +100,8 @@ class BackfillFixture : public crimson::osd::BackfillState::BackfillListener {
 
   FakePrimary backfill_source;
   std::map<pg_shard_t, FakeReplica> backfill_targets;
-
+  std::map<pg_shard_t,
+           std::vector<std::pair<hobject_t, eversion_t>>> enqueued_drops;
   std::deque<
     boost::intrusive_ptr<
       const boost::statechart::event_base>> events_to_dispatch;
@@ -296,11 +297,17 @@ void BackfillFixture::enqueue_drop(
   const hobject_t& obj,
   const eversion_t& v)
 {
-  backfill_targets.at(target).store.drop(obj, v);
+  enqueued_drops[target].emplace_back(obj, v);
 }
 
 void BackfillFixture::maybe_flush()
 {
+  for (const auto& [target, versioned_objs] : enqueued_drops) {
+    for (const auto& [obj, v] : versioned_objs) {
+      backfill_targets.at(target).store.drop(obj, v);
+    }
+  }
+  enqueued_drops.clear();
 }
 
 void BackfillFixture::update_peers_last_backfill(