From: tridao Date: Sat, 15 Jul 2023 02:29:48 +0000 (-0300) Subject: Validate all collections are in the same pool X-Git-Tag: v19.0.0~773^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a84364182a266835a53029e4f0dd55761caa1d56;p=ceph.git Validate all collections are in the same pool Signed-off-by: tridao --- diff --git a/src/test/objectstore/ObjectStoreImitator.cc b/src/test/objectstore/ObjectStoreImitator.cc index 149a1aee68f1..6870d9c81f75 100644 --- a/src/test/objectstore/ObjectStoreImitator.cc +++ b/src/test/objectstore/ObjectStoreImitator.cc @@ -267,6 +267,7 @@ void ObjectStoreImitator::_add_transaction(Transaction *t) { } std::vector 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); diff --git a/src/test/objectstore/ObjectStoreImitator.h b/src/test/objectstore/ObjectStoreImitator.h index 2e68658cb8b9..4116ab9b2adc 100644 --- a/src/test/objectstore/ObjectStoreImitator.h +++ b/src/test/objectstore/ObjectStoreImitator.h @@ -14,6 +14,8 @@ #include #include +#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