Fix vitastor-cli describe --inode and describe/fix hanging on a down OSD #102

Closed
koolkhel wants to merge 3 commits from koolkhel/vitastor:cli-describe-osd-down into master
Contributor

Description

  • Fix vitastor-cli describe listing only one object with --inode. describe --inode, --inode with --min-offset/--max-offset, and --min-inode X --max-inode X listed only the object at offset 0: the OSD ends the listing at (max_inode, max_offset) inclusive and the CLI sent max_offset 0.
  • Fix vitastor-cli describe hanging when an OSD is down. describe, describe --osds 1,2,3 and describe --pool 1 --pg 1 waited forever for a down OSD. PGs with a down primary and down OSDs are now skipped with a warning, and describe exits with EIO after printing what it could list. A new cli_tool_t::json_printed keeps run() from appending the error object after the streamed JSON array, so stdout stays valid JSON.
  • Fix vitastor-cli fix hanging when an OSD is down. fix on an object whose PG primary is down hung, and fix --bad-osds 2 with OSD 2 down exited 0 having done nothing. The first now exits with EIO ("Some objects were not fixed"), the second refuses with EAGAIN. Uses is_osd_up() from the previous commit.

Not changed here: describe --inode still accepts decimal only. uint64_value() on 0x5 gives 0, so describe lists the whole pool. --min-inode/--max-inode already take hex.

Tested: new tests/test_describe.sh, extended by each commit; each part fails without its fix and passes with it.

Contributor Name

Yury Luneff (MIND Software LLC, https://mindsw.io)

CLA

### Description - **Fix vitastor-cli describe listing only one object with --inode.** `describe --inode`, `--inode` with `--min-offset`/`--max-offset`, and `--min-inode X --max-inode X` listed only the object at offset 0: the OSD ends the listing at `(max_inode, max_offset)` inclusive and the CLI sent max_offset 0. - **Fix vitastor-cli describe hanging when an OSD is down.** `describe`, `describe --osds 1,2,3` and `describe --pool 1 --pg 1` waited forever for a down OSD. PGs with a down primary and down OSDs are now skipped with a warning, and describe exits with EIO after printing what it could list. A new `cli_tool_t::json_printed` keeps `run()` from appending the error object after the streamed JSON array, so stdout stays valid JSON. - **Fix vitastor-cli fix hanging when an OSD is down.** `fix` on an object whose PG primary is down hung, and `fix --bad-osds 2` with OSD 2 down exited 0 having done nothing. The first now exits with EIO ("Some objects were not fixed"), the second refuses with EAGAIN. Uses `is_osd_up()` from the previous commit. Not changed here: `describe --inode` still accepts decimal only. `uint64_value()` on `0x5` gives 0, so describe lists the whole pool. `--min-inode`/`--max-inode` already take hex. Tested: new tests/test_describe.sh, extended by each commit; each part fails without its fix and passes with it. ### Contributor Name Yury Luneff (MIND Software LLC, https://mindsw.io) ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
koolkhel added 3 commits 2026-10-25 16:15:01 +03:00
describe --inode sent the range from offset 0 to offset 0 of the inode
and ignored --min-offset and --max-offset, and --max-inode without
--max-offset also ended the range at offset 0 of that inode. The OSD
ends the listing at (max_inode, max_offset) inclusive, so only the
object at offset 0 of the last inode was listed. Honour the offsets
with --inode and end the range at the last offset of max_inode when
--max-offset is not given.
The client queues a request to an OSD which is down until the OSD comes
back, so describe hung forever when a PG primary or an OSD from --osds
was down. Skip such PGs and OSDs with a warning, ask only the primary
of the PG when --pool and --pg are given, and exit with EIO after
printing what could be listed, so that a partial listing is not taken
for a complete one. With --json, stdout stays a valid JSON array.
The client queues a request to an OSD which is down until the OSD comes
back, so fix hung forever when the primary of an object's PG or one of
--bad-osds was down. Refuse to start while one of --bad-osds is down,
skip objects whose PG primary is down as it is done for inactive PGs,
and exit with EIO when some objects were skipped or a request failed,
so that a partial repair is not taken for a complete one.
Owner

Замержил отдельными коммитами + чутьчуть поправил (флаг parent->json_printed мне не понравился)

Замержил отдельными коммитами + чутьчуть поправил (флаг parent->json_printed мне не понравился)
vitalif closed this pull request 2026-10-25 22:18:52 +03:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#102
No description provided.