From: Mingxin Liu Date: Thu, 22 Jul 2021 04:21:53 +0000 (+0800) Subject: osd/PGLog: set acceptable rollback_info_trimmed_to for pg of replicated pool X-Git-Tag: v17.1.0~1236^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42445%2Fhead;p=ceph.git osd/PGLog: set acceptable rollback_info_trimmed_to for pg of replicated pool if this PG belongs to a replica pool, since replica pool does not require rollback, see `pg_pool_t::require_rollback()`, we don't update the omap entry for noting down the `on_disk_rollback_info_trimmed_to`. see `PGLog::_write_log_and_missing()` and `PGLog::_write_log_and_missing()`. in this case, `read_log_and_missing()` should not be able to find the value for "rollback_info_trimmed_to" in the omap entries. because `roll_foward_to()` replays all entries starting at `rollback_info_trimmed_to`, if it is empty, when the primary osd is merging the pglog from its peers while peering, it would have to walk through *all* pglog entries. this would incur unnecessary overhead, and slows down the peering. in this change, if this PG belongs to a replica pool, we just fast forward it to `info.last_update` to avoid this overhead. Signed-off-by: Mingxin Liu --- diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index be3f7414d69..c5e0a10ea96 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -1095,6 +1095,11 @@ namespace { return iter->next(); }); }).then([this] { + if (info.pgid.is_no_shard()) { + // replicated pool pg does not persist this key + assert(on_disk_rollback_info_trimmed_to == eversion_t()); + on_disk_rollback_info_trimmed_to = info.last_update; + } log = PGLog::IndexedLog( info.last_update, info.log_tail, diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 920b40dabc1..25c88217c51 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -1490,6 +1490,11 @@ public: } } } + if (info.pgid.is_no_shard()) { + // replicated pool pg does not persist this key + assert(on_disk_rollback_info_trimmed_to == eversion_t()); + on_disk_rollback_info_trimmed_to = info.last_update; + } log = IndexedLog( info.last_update, info.log_tail,