]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Validate all collections are in the same pool
authortridao <daominhtri0503@gmail.com>
Sat, 15 Jul 2023 02:29:48 +0000 (23:29 -0300)
committertridao <daominhtri0503@gmail.com>
Mon, 17 Jul 2023 02:23:24 +0000 (23:23 -0300)
Signed-off-by: tridao <daominhtri0503@gmail.com>
src/test/objectstore/ObjectStoreImitator.cc
src/test/objectstore/ObjectStoreImitator.h

index 149a1aee68f108ea1530dd89b0fc2ff229a95ceb..6870d9c81f754dea61be393bba148c90d6bd73f0 100644 (file)
@@ -267,6 +267,7 @@ void ObjectStoreImitator::_add_transaction(Transaction *t) {
   }
 
   std::vector<ObjectRef> ovec(i.objects.size());
+  uint64_t prev_pool_id = META_POOL_ID;
 
   for (int pos = 0; i.have_op(); ++pos) {
     Transaction::Op *op = i.decode_op();
@@ -279,6 +280,13 @@ void ObjectStoreImitator::_add_transaction(Transaction *t) {
     // collection operations
     CollectionRef &c = cvec[op->cid];
 
+    // validate all collections are in the same pool
+    spg_t pgid;
+    if (!!c && c->cid.is_pg(&pgid)) {
+      ceph_assert(prev_pool_id == pgid.pool() || prev_pool_id == META_POOL_ID);
+      prev_pool_id = pgid.pool();
+    }
+
     switch (op->op) {
     case Transaction::OP_RMCOLL: {
       const coll_t &cid = i.get_cid(op->cid);
index 2e68658cb8b90e9932dd6090d6472e8d025eec94..4116ab9b2adce2f8f8c186fd5f81570e1d6c8ada 100644 (file)
@@ -14,6 +14,8 @@
 #include <algorithm>
 #include <boost/smart_ptr/intrusive_ptr.hpp>
 
+#define META_POOL_ID ((uint64_t)-1ull)
+
 /**
  * ObjectStoreImitator will simulate how BlueStore does IO (as of the time
  * the simulator is written) and assess the defragmentation levels of different