crimson/osd: use logger() instead of crimson::get_logger(...)

for better readability

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2020-08-30 16:47:10 +08:00
parent f16b628c9e
commit fadb26dc43
2 changed files with 23 additions and 41 deletions

View File

@ -98,12 +98,10 @@ seastar::future<> ClientRequest::start()
return seastar::stop_iteration::yes;
}).handle_exception_type([](crimson::common::actingset_changed& e) {
if (e.is_primary()) {
crimson::get_logger(ceph_subsys_osd).debug(
"operation restart, acting set changed");
logger().debug("operation restart, acting set changed");
return seastar::stop_iteration::no;
} else {
crimson::get_logger(ceph_subsys_osd).debug(
"operation abort, up primary changed");
logger().debug("operation abort, up primary changed");
return seastar::stop_iteration::yes;
}
});

View File

@ -61,8 +61,8 @@ PGRecovery::start_recovery_ops(size_t max_to_start)
[this] {
bool done = !pg->get_peering_state().needs_recovery();
if (done) {
crimson::get_logger(ceph_subsys_osd).debug("start_recovery_ops: AllReplicasRecovered for pg: {}",
pg->get_pgid());
logger().debug("start_recovery_ops: AllReplicasRecovered for pg: {}",
pg->get_pgid());
using LocalPeeringEvent = crimson::osd::LocalPeeringEvent;
if (!pg->get_peering_state().needs_backfill()) {
logger().debug("start_recovery_ops: AllReplicasRecovered for pg: {}",
@ -107,12 +107,10 @@ size_t PGRecovery::start_primary_recovery_ops(
const auto &missing = pg->get_peering_state().get_pg_log().get_missing();
crimson::get_logger(ceph_subsys_osd).info(
"{} recovering {} in pg {}, missing {}",
__func__,
pg->get_recovery_backend()->total_recovering(),
*static_cast<crimson::osd::PG*>(pg),
missing);
logger().info("{} recovering {} in pg {}, missing {}", __func__,
pg->get_recovery_backend()->total_recovering(),
*static_cast<crimson::osd::PG*>(pg),
missing);
unsigned started = 0;
int skipped = 0;
@ -138,7 +136,7 @@ size_t PGRecovery::start_primary_recovery_ops(
hobject_t head = soid.get_head();
crimson::get_logger(ceph_subsys_osd).info(
logger().info(
"{} {} item.need {} {} {} {} {}",
__func__,
soid,
@ -167,11 +165,7 @@ size_t PGRecovery::start_primary_recovery_ops(
pg->get_peering_state().set_last_requested(v);
}
crimson::get_logger(ceph_subsys_osd).info(
"{} started {} skipped {}",
__func__,
started,
skipped);
logger().info("{} started {} skipped {}", __func__, started, skipped);
return started;
}
@ -192,12 +186,10 @@ size_t PGRecovery::start_replica_recovery_ops(
assert(peer != pg->get_peering_state().get_primary());
const auto& pm = pg->get_peering_state().get_peer_missing(peer);
crimson::get_logger(ceph_subsys_osd).debug(
"{}: peer osd.{} missing {} objects", __func__,
peer, pm.num_missing());
crimson::get_logger(ceph_subsys_osd).trace(
"{}: peer osd.{} missing {}", __func__,
peer, pm.get_items());
logger().debug("{}: peer osd.{} missing {} objects", __func__,
peer, pm.num_missing());
logger().trace("{}: peer osd.{} missing {}", __func__,
peer, pm.get_items());
// recover oldest first
for (auto p = pm.get_rmissing().begin();
@ -206,15 +198,14 @@ size_t PGRecovery::start_replica_recovery_ops(
const auto &soid = p->second;
if (pg->get_peering_state().get_missing_loc().is_unfound(soid)) {
crimson::get_logger(ceph_subsys_osd).debug(
"{}: object {} still unfound", __func__, soid);
logger().debug("{}: object {} still unfound", __func__, soid);
continue;
}
const pg_info_t &pi = pg->get_peering_state().get_peer_info(peer);
if (soid > pi.last_backfill) {
if (!pg->get_recovery_backend()->is_recovering(soid)) {
crimson::get_logger(ceph_subsys_osd).error(
logger().error(
"{}: object {} in missing set for backfill (last_backfill {})"
" but not in recovering",
__func__,
@ -226,14 +217,12 @@ size_t PGRecovery::start_replica_recovery_ops(
}
if (pg->get_recovery_backend()->is_recovering(soid)) {
crimson::get_logger(ceph_subsys_osd).debug(
"{}: already recovering object {}", __func__, soid);
logger().debug("{}: already recovering object {}", __func__, soid);
continue;
}
if (pg->get_peering_state().get_missing_loc().is_deleted(soid)) {
crimson::get_logger(ceph_subsys_osd).debug(
"{}: soid {} is a delete, removing", __func__, soid);
logger().debug("{}: soid {} is a delete, removing", __func__, soid);
map<hobject_t,pg_missing_item>::const_iterator r =
pm.get_items().find(soid);
started += prep_object_replica_deletes(
@ -244,22 +233,17 @@ size_t PGRecovery::start_replica_recovery_ops(
if (soid.is_snap() &&
pg->get_peering_state().get_pg_log().get_missing().is_missing(
soid.get_head())) {
crimson::get_logger(ceph_subsys_osd).debug(
"{}: head {} still missing on primary",
__func__, soid.get_head());
logger().debug("{}: head {} still missing on primary", __func__,
soid.get_head());
continue;
}
if (pg->get_peering_state().get_pg_log().get_missing().is_missing(soid)) {
crimson::get_logger(ceph_subsys_osd).debug(
"{}: soid {} still missing on primary", __func__, soid);
logger().debug("{}: soid {} still missing on primary", __func__, soid);
continue;
}
crimson::get_logger(ceph_subsys_osd).debug(
"{}: recover_object_replicas({})",
__func__,
soid);
logger().debug("{}: recover_object_replicas({})", __func__,soid);
map<hobject_t,pg_missing_item>::const_iterator r = pm.get_items().find(
soid);
started += prep_object_replica_pushes(
@ -351,7 +335,7 @@ void PGRecovery::on_global_recover (
const object_stat_sum_t& stat_diff,
const bool is_delete)
{
crimson::get_logger(ceph_subsys_osd).info("{} {}", __func__, soid);
logger().info("{} {}", __func__, soid);
pg->get_peering_state().object_recovered(soid, stat_diff);
auto& recovery_waiter = pg->get_recovery_backend()->get_recovering(soid);
if (!is_delete)