Add --pg parameter to vitastor-cli describe, print objects with 0x in human-readable format too
Test / buildenv (push) Successful in 10s Details
Test / build (push) Successful in 3m7s Details
Test / test_cas (push) Successful in 8s Details
Test / make_test (push) Successful in 37s Details
Test / test_change_pg_size (push) Successful in 9s Details
Test / test_change_pg_count (push) Successful in 41s Details
Test / test_change_pg_count_ec (push) Successful in 36s Details
Test / test_create_nomaxid (push) Successful in 8s Details
Test / test_etcd_fail (push) Successful in 57s Details
Test / test_add_osd (push) Successful in 2m44s Details
Test / test_interrupted_rebalance (push) Successful in 2m41s Details
Test / test_failure_domain (push) Successful in 10s Details
Test / test_interrupted_rebalance_imm (push) Successful in 2m59s Details
Test / test_interrupted_rebalance_ec (push) Successful in 2m29s Details
Test / test_snapshot (push) Successful in 38s Details
Test / test_snapshot_ec (push) Successful in 34s Details
Test / test_minsize_1 (push) Successful in 15s Details
Test / test_move_reappear (push) Successful in 21s Details
Test / test_rm (push) Successful in 16s Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 2m4s Details
Test / test_snapshot_down (push) Successful in 26s Details
Test / test_snapshot_down_ec (push) Successful in 30s Details
Test / test_splitbrain (push) Successful in 18s Details
Test / test_snapshot_chain (push) Successful in 2m32s Details
Test / test_snapshot_chain_ec (push) Successful in 3m11s Details
Test / test_rebalance_verify_imm (push) Successful in 3m34s Details
Test / test_rebalance_verify (push) Successful in 4m12s Details
Test / test_switch_primary (push) Successful in 33s Details
Test / test_write (push) Successful in 52s Details
Test / test_write_xor (push) Successful in 54s Details
Test / test_write_no_same (push) Successful in 13s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 4m6s Details
Test / test_rebalance_verify_ec (push) Successful in 5m1s Details
Test / test_heal_pg_size_2 (push) Successful in 4m15s Details
Test / test_heal_ec (push) Successful in 4m11s Details
Test / test_heal_csum_32k_dmj (push) Successful in 6m4s Details
Test / test_heal_csum_32k_dj (push) Successful in 5m59s Details
Test / test_heal_csum_32k (push) Successful in 6m42s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m40s Details
Test / test_scrub_zero_osd_2 (push) Successful in 55s Details
Test / test_scrub (push) Successful in 58s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m22s Details
Test / test_heal_csum_4k (push) Successful in 6m24s Details
Test / test_scrub_pg_size_3 (push) Successful in 2m11s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 25s Details
Test / test_scrub_ec (push) Successful in 23s Details
Test / test_nfs (push) Successful in 13s Details
Test / test_scrub_xor (push) Successful in 18s Details

master
Vitaliy Filippov 2024-04-07 12:39:46 +03:00
parent 02993ee1dd
commit 20fbc4a745
6 changed files with 35 additions and 14 deletions

View File

@ -186,11 +186,9 @@ Merge layer data without changing metadata. Merge `<from>`..`<to>` to `<target>`
## describe
`vitastor-cli describe [--osds <osds>] [--object-state <states>] [--pool <pool>]
[--inode <ino>] [--min-inode <ino>] [--max-inode <ino>]
[--min-offset <offset>] [--max-offset <offset>]`
`vitastor-cli describe [OPTIONS]`
Describe unclean object locations in the cluster.
Describe unclean object locations in the cluster. Options:
```
--osds <osds>
@ -200,6 +198,8 @@ Describe unclean object locations in the cluster.
degraded, misplaced, incomplete, corrupted, inconsistent.
--pool <pool name or number>
Only list objects in the given pool.
--pg <pg number>
Only list objects in the given PG of the pool.
--inode, --min-inode, --max-inode
Restrict listing to specific inode numbers.
--min-offset, --max-offset

View File

@ -194,12 +194,10 @@ vitastor-cli snap-create [-p|--pool <id|name>] <image>@<snapshot>
## describe
`vitastor-cli describe [--osds <osds>] [--object-state <состояния>] [--pool <пул>]
[--inode <номер>] [--min-inode <номер>] [--max-inode <номер>]
[--min-offset <смещение>] [--max-offset <смещение>]`
`vitastor-cli describe [ОПЦИИ]`
Описать состояние "грязных" объектов в кластере, то есть таких объектов, копии
или части которых хранятся на наборе OSD, не равном целевому.
или части которых хранятся на наборе OSD, не равном целевому. Опции:
```
--osds <osds>
@ -214,6 +212,8 @@ vitastor-cli snap-create [-p|--pool <id|name>] <image>@<snapshot>
- inconsistent - неконсистентный, с неоднозначным расхождением копий/частей
--pool <имя или ID пула>
Перечислять только объекты из заданного пула.
--pg <номер PG>
Перечислять только объекты из заданной PG пула.
--inode, --min-inode, --max-inode
Перечислять только объекты из указанных номеров инодов (образов).
--min-offset, --max-offset

View File

@ -76,8 +76,8 @@ static const char* help_text =
" <to> must be a child of <from> and <target> may be one of the layers between\n"
" <from> and <to>, including <from> and <to>.\n"
"\n"
"vitastor-cli describe [--osds <osds>] [--object-state <states>] [--pool <pool>] [--inode <ino>] [--min-inode <ino>] [--max-inode <ino>] [--min-offset <offset>] [--max-offset <offset>]\n"
" Describe unclean object locations in the cluster.\n"
"vitastor-cli describe [OPTIONS]\n"
" Describe unclean object locations in the cluster. Options:\n"
" --osds <osds>\n"
" Only list objects from primary OSD(s) <osds>.\n"
" --object-state <states>\n"
@ -85,6 +85,8 @@ static const char* help_text =
" degraded, misplaced, incomplete, corrupted, inconsistent.\n"
" --pool <pool name or number>\n"
" Only list objects in the given pool.\n"
" --pg <pg number>\n"
" Only list objects in the given PG of the pool.\n"
" --inode, --min-inode, --max-inode\n"
" Restrict listing to specific inode numbers.\n"
" --min-offset, --max-offset\n"

View File

@ -37,6 +37,7 @@ struct cli_describe_t
{
uint64_t object_state = 0;
pool_id_t only_pool = 0;
pg_num_t only_pg = 0;
std::vector<uint64_t> only_osds;
uint64_t min_inode = 0, max_inode = 0;
uint64_t min_offset = 0, max_offset = 0;
@ -68,6 +69,7 @@ struct cli_describe_t
}
}
}
only_pg = cfg["pg"].uint64_value();
min_inode = cfg["inode"].uint64_value();
if (min_inode)
{
@ -142,8 +144,8 @@ struct cli_describe_t
{
osd_op_t *op = new osd_op_t;
op->req = (osd_any_op_t){
.describe = {
.header = {
.describe = (osd_op_describe_t){
.header = (osd_op_header_t){
.magic = SECONDARY_OSD_OP_MAGIC,
.id = parent->cli->next_op_id(),
.opcode = OSD_OP_DESCRIBE,
@ -153,6 +155,8 @@ struct cli_describe_t
.min_offset = min_offset,
.max_inode = max_inode,
.max_offset = max_offset,
.pool_id = only_pool,
.pg_num = only_pg,
},
};
op->callback = [this, osd_num = only_osds[i]](osd_op_t *op)
@ -182,7 +186,7 @@ struct cli_describe_t
printf(
(parent->json_output
? (count > 0 ? ",\n " FMT : " " FMT)
: "%jx:%jx part %u on OSD %ju%s%s%s\n"),
: "0x%jx:0x%jx part %u on OSD %ju%s%s%s\n"),
#undef FMT
items[i].inode, items[i].stripe,
items[i].role, items[i].osd_num,

View File

@ -258,6 +258,9 @@ struct __attribute__((__packed__)) osd_op_describe_t
uint64_t max_inode, max_offset;
// limit
uint64_t limit;
// pool and PG
uint32_t pool_id;
uint32_t pg_num;
};
struct __attribute__((__packed__)) osd_reply_describe_t

View File

@ -95,7 +95,19 @@ void osd_t::continue_primary_describe(osd_op_t *cur_op)
if (!desc.object_state)
desc.object_state = ~desc.object_state;
std::vector<unclean_list_t> lists;
for (auto pg_it = pgs.begin(); pg_it != pgs.end(); pg_it++)
auto pg_first = pgs.begin();
auto pg_last = pgs.end();
if (desc.pool_id && desc.pg_num)
{
pg_first = pgs.find((pool_pg_num_t){ .pool_id = desc.pool_id, .pg_num = desc.pg_num });
pg_last = pg_first != pgs.end() ? std::next(pg_first) : pgs.end();
}
else if (desc.pool_id)
{
pg_first = pgs.lower_bound((pool_pg_num_t){ .pool_id = desc.pool_id });
pg_last = pgs.lower_bound((pool_pg_num_t){ .pool_id = desc.pool_id+1 });
}
for (auto pg_it = pg_first; pg_it != pg_last; pg_it++)
{
auto & pg = pg_it->second;
if (desc.object_state & OBJ_INCONSISTENT)