Improve debugging output for incomplete/degraded

Vitaliy Filippov 2020-10-24 01:19:20 +03:00
parent faa5e1436f
commit 660c2412fb
2 changed files with 10 additions and 20 deletions

View File

@ -136,7 +136,7 @@ void etcd_state_client_t::start_etcd_watcher()
} }
for (auto & kv: changes) for (auto & kv: changes)
{ {
if (this->log_level > 1) if (this->log_level > 3)
{ {
printf("Incoming event: %s -> %s\n", kv.first.c_str(), kv.second.dump().c_str()); printf("Incoming event: %s -> %s\n", kv.first.c_str(), kv.second.dump().c_str());
} }

View File

@ -237,7 +237,7 @@ void pg_obj_state_check_t::finish_object()
{ {
if (log_level > 1) if (log_level > 1)
{ {
printf("Object is incomplete: inode=%lu stripe=%lu version=%lu/%lu\n", oid.inode, oid.stripe, target_ver, max_ver); printf("Object is incomplete: %lx:%lx version=%lu/%lu\n", oid.inode, oid.stripe, target_ver, max_ver);
} }
state = OBJ_INCOMPLETE; state = OBJ_INCOMPLETE;
pg->state = pg->state | PG_HAS_INCOMPLETE; pg->state = pg->state | PG_HAS_INCOMPLETE;
@ -246,37 +246,27 @@ void pg_obj_state_check_t::finish_object()
{ {
if (log_level > 1) if (log_level > 1)
{ {
printf("Object is degraded: inode=%lu stripe=%lu version=%lu/%lu\n", oid.inode, oid.stripe, target_ver, max_ver); printf("Object is degraded: %lx:%lx version=%lu/%lu\n", oid.inode, oid.stripe, target_ver, max_ver);
} }
state = OBJ_DEGRADED; state = OBJ_DEGRADED;
pg->state = pg->state | PG_HAS_DEGRADED; pg->state = pg->state | PG_HAS_DEGRADED;
} }
else if (n_mismatched > 0) else if (n_mismatched > 0)
{ {
if (log_level > 1 && (replicated || n_roles >= pg->pg_cursize)) if (log_level > 2 && (replicated || n_roles >= pg->pg_cursize))
{ {
printf("Object is misplaced: inode=%lu stripe=%lu version=%lu/%lu\n", oid.inode, oid.stripe, target_ver, max_ver); printf("Object is misplaced: %lx:%lx version=%lu/%lu\n", oid.inode, oid.stripe, target_ver, max_ver);
} }
state |= OBJ_MISPLACED; state |= OBJ_MISPLACED;
pg->state = pg->state | PG_HAS_MISPLACED; pg->state = pg->state | PG_HAS_MISPLACED;
} }
if (log_level > 1 && ((replicated ? n_copies : n_roles) < pg->pg_cursize || n_mismatched > 0)) if (log_level > 1 && (state & (OBJ_INCOMPLETE | OBJ_DEGRADED)) ||
log_level > 2 && (state & OBJ_MISPLACED))
{ {
if (log_level > 2) for (int i = obj_start; i < obj_end; i++)
{ {
for (int i = obj_start; i < obj_end; i++) printf("v%lu present on: osd %lu, role %ld%s\n", list[i].version, list[i].osd_num,
{ (list[i].oid.stripe & STRIPE_MASK), list[i].is_stable ? " (stable)" : "");
printf("v%lu present on: osd %lu, role %ld%s\n", list[i].version, list[i].osd_num,
(list[i].oid.stripe & STRIPE_MASK), list[i].is_stable ? " (stable)" : "");
}
}
else
{
for (int i = ver_start; i < ver_end; i++)
{
printf("Target version present on: osd %lu, role %ld%s\n", list[i].osd_num,
(list[i].oid.stripe & STRIPE_MASK), list[i].is_stable ? " (stable)" : "");
}
} }
} }
pg->total_count++; pg->total_count++;