From e8b9ab73f409d5d9a51100f5dd9922dfcab5dc0e Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Wed, 6 Mar 2024 13:49:43 +0800 Subject: [PATCH] crimson/os/seastore/collection_manager: allow empty-delta-buffer collection nodes Fixes: https://tracker.ceph.com/issues/64728 Signed-off-by: Xuehan Xu --- .../collection_manager/collection_flat_node.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/crimson/os/seastore/collection_manager/collection_flat_node.h b/src/crimson/os/seastore/collection_manager/collection_flat_node.h index 2690fb5fdf464..aa1e713561308 100644 --- a/src/crimson/os/seastore/collection_manager/collection_flat_node.h +++ b/src/crimson/os/seastore/collection_manager/collection_flat_node.h @@ -153,10 +153,19 @@ struct CollectionNode } ceph::bufferlist get_delta() final { - assert(!delta_buffer.empty()); ceph::bufferlist bl; - encode(delta_buffer, bl); - delta_buffer.clear(); + // FIXME: CollectionNodes are always first mutated and + // then checked whether they have enough space, + // and if not, new ones will be created and the + // mutation_pending ones are left untouched. + // + // The above order should be reversed, nodes should + // be mutated only if there are enough space for new + // entries. + if (!delta_buffer.empty()) { + encode(delta_buffer, bl); + delta_buffer.clear(); + } return bl; } -- 2.39.5