From 562aad626ff2856dd5427ac7c418f540a4776795 Mon Sep 17 00:00:00 2001 From: Alex Ainscow Date: Wed, 26 Feb 2025 15:22:54 +0000 Subject: [PATCH] osd: truncate shard object to correct size with ECSwitch. The implementation of ECSwitch above dropped an override of rollback_append. This was causing rollback to be truncated to the incorrect size. This fix updates PGBackend to use a replacement API (object_size_to_shard_size) to determine the correct shard size. This is clearer than the previous override code and is borrowed from the forthcoming EC optimisations. Signed-off-by: Alex Ainscow --- src/osd/PGBackend.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index dffe8ff21de..98704b681b9 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -208,7 +208,8 @@ void PGBackend::rollback( PGBackend *pg) : hoid(hoid), pg(pg) {} void append(uint64_t old_size) override { ObjectStore::Transaction temp; - pg->rollback_append(hoid, old_size, &temp); + const uint64_t shard_size = pg->object_size_to_shard_size(old_size, pg->get_parent()->whoami_shard().shard); + pg->rollback_append(hoid, shard_size, &temp); temp.append(t); temp.swap(t); } @@ -500,13 +501,13 @@ void PGBackend::rollback_setattrs( void PGBackend::rollback_append( const hobject_t &hoid, - uint64_t old_size, + uint64_t old_shard_size, ObjectStore::Transaction *t) { ceph_assert(!hoid.is_temp()); t->truncate( coll, ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard), - old_size); + old_shard_size); } void PGBackend::rollback_stash( -- 2.39.5