Skip to content

Commit 5208cc6

Browse files
committed
crimson/os/seastore: add support for OP_SPLIT_COLLECTION2
Fixes: https://tracker.ceph.com/issues/72173 Signed-off-by: Xuehan Xu <[email protected]>
1 parent b352f56 commit 5208cc6

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

src/crimson/os/seastore/seastore.cc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,15 @@ SeaStore::Shard::_do_transaction_step(
16611661
i.decode_bl(hint);
16621662
return tm_iertr::now();
16631663
}
1664+
case Transaction::OP_SPLIT_COLLECTION2:
1665+
{
1666+
uint32_t bits = op->split_bits;
1667+
coll_t cid = i.get_cid(op->cid);
1668+
coll_t dest_cid = i.get_cid(op->dest_cid);
1669+
DEBUGT("op OP_SPLIT_COLLECTION2, cid={}, dest_cid={}, bits={}",
1670+
*ctx.transaction, cid, dest_cid, bits);
1671+
return _split_collection(ctx, cid, bits);
1672+
}
16641673
}
16651674

16661675
using onode_iertr = OnodeManager::get_onode_iertr::extend<
@@ -2239,6 +2248,40 @@ SeaStore::Shard::_rmattrs(
22392248
onode);
22402249
}
22412250

2251+
SeaStore::Shard::tm_ret
2252+
SeaStore::Shard::_split_collection(
2253+
internal_context_t &ctx,
2254+
const coll_t &cid,
2255+
int bits)
2256+
{
2257+
return transaction_manager->read_collection_root(
2258+
*ctx.transaction
2259+
).si_then([=, this, &ctx](auto _cmroot) {
2260+
return seastar::do_with(
2261+
_cmroot,
2262+
[=, this, &ctx](auto &cmroot) {
2263+
return collection_manager->update(
2264+
cmroot,
2265+
*ctx.transaction,
2266+
cid,
2267+
bits
2268+
).si_then([this, &ctx, &cmroot] {
2269+
if (cmroot.must_update()) {
2270+
transaction_manager->write_collection_root(
2271+
*ctx.transaction,
2272+
cmroot);
2273+
}
2274+
});
2275+
}
2276+
);
2277+
}).handle_error_interruptible(
2278+
tm_iertr::pass_further{},
2279+
crimson::ct_error::assert_all{
2280+
"Invalid error in SeaStoreS::_create_collection"
2281+
}
2282+
);
2283+
}
2284+
22422285
SeaStore::Shard::tm_ret
22432286
SeaStore::Shard::_create_collection(
22442287
internal_context_t &ctx,

src/crimson/os/seastore/seastore.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ class SeaStore final : public FuturizedStore {
437437
tm_ret _create_collection(
438438
internal_context_t &ctx,
439439
const coll_t& cid, int bits);
440+
tm_ret _split_collection(
441+
internal_context_t &ctx,
442+
const coll_t& cid, int bits);
440443
tm_ret _remove_collection(
441444
internal_context_t &ctx,
442445
const coll_t& cid);

0 commit comments

Comments
 (0)