Skip to content

Commit 562aad6

Browse files
committed
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 <[email protected]>
1 parent dd4248f commit 562aad6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/osd/PGBackend.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ void PGBackend::rollback(
208208
PGBackend *pg) : hoid(hoid), pg(pg) {}
209209
void append(uint64_t old_size) override {
210210
ObjectStore::Transaction temp;
211-
pg->rollback_append(hoid, old_size, &temp);
211+
const uint64_t shard_size = pg->object_size_to_shard_size(old_size, pg->get_parent()->whoami_shard().shard);
212+
pg->rollback_append(hoid, shard_size, &temp);
212213
temp.append(t);
213214
temp.swap(t);
214215
}
@@ -500,13 +501,13 @@ void PGBackend::rollback_setattrs(
500501

501502
void PGBackend::rollback_append(
502503
const hobject_t &hoid,
503-
uint64_t old_size,
504+
uint64_t old_shard_size,
504505
ObjectStore::Transaction *t) {
505506
ceph_assert(!hoid.is_temp());
506507
t->truncate(
507508
coll,
508509
ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
509-
old_size);
510+
old_shard_size);
510511
}
511512

512513
void PGBackend::rollback_stash(

0 commit comments

Comments
 (0)