]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/test: check flush hasn't been called regarding EBUSY
authormyoungwon oh <ohmyoungwon@gmail.com>
Sat, 6 Mar 2021 13:35:54 +0000 (22:35 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Mon, 29 Mar 2021 08:22:47 +0000 (17:22 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/test/osd/Object.h
src/test/osd/RadosModel.h

index a78a598236d025df326f849c2fca42349d331f6e..76ce2d2a2fc8cad8a4e9d33d54c93088018ec8ca 100644 (file)
@@ -316,10 +316,10 @@ class ObjectDesc {
 public:
   ObjectDesc()
     : exists(false), dirty(false),
-      version(0) {}
+      version(0), flushed(false) {}
   ObjectDesc(const ContDesc &init, ContentsGenerator *cont_gen)
     : exists(false), dirty(false),
-      version(0) {
+      version(0), flushed(false) {
     layers.push_front(std::pair<std::shared_ptr<ContentsGenerator>, ContDesc>(std::shared_ptr<ContentsGenerator>(cont_gen), init));
   }
 
@@ -532,6 +532,7 @@ public:
   uint64_t version;
   std::string redirect_target;
   std::map<uint64_t, ChunkDesc> chunk_info;
+  bool flushed;
 private:
   std::list<std::pair<std::shared_ptr<ContentsGenerator>, ContDesc> > layers;
 };
index 64e8d82b54a1781af0587de04eec510e86eb2b73..e0510e8a2c969db339c86e8129beb29a38cac84a 100644 (file)
@@ -589,6 +589,42 @@ public:
     pool_obj_cont.rbegin()->second.insert_or_assign(oid, contents);
   }
 
+  void update_object_tier_flushed(const string &oid, int snap)
+  {
+    for (map<int, map<string,ObjectDesc> >::reverse_iterator i = 
+          pool_obj_cont.rbegin();
+        i != pool_obj_cont.rend();
+        ++i) {
+      if (snap != -1 && snap < i->first)
+       continue;
+      map<string,ObjectDesc>::iterator j = i->second.find(oid);
+      if (j != i->second.end()) {
+       j->second.flushed = true;
+       break;
+      }
+    }
+  }
+
+  bool check_oldest_snap_flushed(const string &oid, int snap) 
+  {
+    for (map<int, map<string,ObjectDesc> >::reverse_iterator i = 
+          pool_obj_cont.rbegin();
+        i != pool_obj_cont.rend();
+        ++i) {
+      if (snap != -1 && snap < i->first)
+       continue;
+      map<string,ObjectDesc>::iterator j = i->second.find(oid);
+      if (j != i->second.end() && !j->second.flushed) {
+       cout << __func__ << " oid " << oid
+            << " v " << j->second.version << " " << j->second.most_recent()
+            << " " << (j->second.flushed ? "flushed" : "unflushed")
+            << " " << i->first << std::endl;
+       return false;
+      }
+    }
+    return true;
+  }
+
   bool check_chunks_refcount(librados::IoCtx &chunk_pool_ctx, librados::IoCtx &manifest_pool_ctx)
   {
     librados::ObjectCursor shard_start;
@@ -2882,6 +2918,8 @@ public:
       snap = -1;
     }
 
+    cout << num << ": tier_flush oid " << oid << " snap " << snap << std::endl;
+
     if (snap >= 0) {
       context->io_ctx.snap_set_read(context->snaps[snap]);
     }
@@ -2918,11 +2956,13 @@ public:
       // sucess
     } else if (r == -EBUSY) {
       // could fail if snap is not oldest
+      ceph_assert(!context->check_oldest_snap_flushed(oid, snap)); 
     } else if (r == -ENOENT && src_value.deleted()) {
       // could fail if object is removed
     } else {
       ceph_abort_msg("shouldn't happen");
     }
+    context->update_object_tier_flushed(oid, snap);
     context->update_object_version(oid, completion->get_version64(), snap);
     context->oid_in_use.erase(oid);
     context->oid_not_in_use.insert(oid);