]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: truncate shard object to correct size with ECSwitch. 61263/head
authorAlex Ainscow <aainscow@uk.ibm.com>
Wed, 26 Feb 2025 15:22:54 +0000 (15:22 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Thu, 27 Feb 2025 10:44:24 +0000 (10:44 +0000)
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 <aainscow@uk.ibm.com>
src/osd/PGBackend.cc

index dffe8ff21de97092718c8651e7e242de4fce51b7..98704b681b9b5b2e73763a4c8161461966089b25 100644 (file)
@@ -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(