OSD: Pass max_stripe = UINT64_MAX to the store in primary LIST #187

Open
koolkhel wants to merge 1 commits from koolkhel/vitastor:osd-primary-list-max-stripe into master
Contributor

Description

continue_primary_list() set the store LIST upper bound only when max_stripe != UINT64_MAX. A primary LIST (OSD_OP_SEC_LIST with OSD_LIST_PRIMARY) up to max_stripe = UINT64_MAX therefore gave the store max_oid = {inode, 0}, which is below min_oid as soon as min_stripe > 0:

  • store v1 drops an upper bound below min_oid (blockstore/v1/impl.cpp, the clean_db and dirty_db loops) and lists the rest of the PG shard: objects of every higher-numbered inode of the pool in that PG, at any stripe;
  • the new store filters by the bounds and lists nothing.

The client passes the reply on as is (cluster_client_list.cpp), and rm-data filters only by stripe and deletes obj_pos->inode, i.e. the listed object's own inode, with OSD_OP_IGNORE_READONLY. So vitastor-cli rm-data --inode N --min-offset X --max-offset 18446744073709551615 (also --max-offset -1, which uint64_value() turns into the same number) deletes objects of other inodes at offsets >= X on store v1, or reports success without deleting anything on the new store. Other list_inode() callers pass no upper bound and are not affected.

This sets the bound the same way as the non-primary LIST in osd_secondary.cpp. It also fixes the protocol comment in osd_ops.h: since b8eaaabf the non-primary LIST no longer treats max_stripe = UINT64_MAX as 0, and with this change the primary one does not either.

Tested: new test_primary_list_max_stripe_bound in osd_test (a primary LIST with min_stripe=0x20000, max_stripe=UINT64_MAX must give the store max_oid = {inode, UINT64_MAX}). It fails without the fix; with the fix the whole osd_test passes.

Contributor Name

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

CLA

### Description `continue_primary_list()` set the store LIST upper bound only when `max_stripe != UINT64_MAX`. A primary LIST (`OSD_OP_SEC_LIST` with `OSD_LIST_PRIMARY`) up to `max_stripe = UINT64_MAX` therefore gave the store `max_oid = {inode, 0}`, which is below `min_oid` as soon as `min_stripe > 0`: - store v1 drops an upper bound below `min_oid` (`blockstore/v1/impl.cpp`, the clean_db and dirty_db loops) and lists the rest of the PG shard: objects of every higher-numbered inode of the pool in that PG, at any stripe; - the new store filters by the bounds and lists nothing. The client passes the reply on as is (`cluster_client_list.cpp`), and `rm-data` filters only by stripe and deletes `obj_pos->inode`, i.e. the listed object's own inode, with `OSD_OP_IGNORE_READONLY`. So `vitastor-cli rm-data --inode N --min-offset X --max-offset 18446744073709551615` (also `--max-offset -1`, which `uint64_value()` turns into the same number) deletes objects of other inodes at offsets >= X on store v1, or reports success without deleting anything on the new store. Other `list_inode()` callers pass no upper bound and are not affected. This sets the bound the same way as the non-primary LIST in `osd_secondary.cpp`. It also fixes the protocol comment in `osd_ops.h`: since `b8eaaabf` the non-primary LIST no longer treats `max_stripe = UINT64_MAX` as 0, and with this change the primary one does not either. Tested: new `test_primary_list_max_stripe_bound` in `osd_test` (a primary LIST with `min_stripe=0x20000`, `max_stripe=UINT64_MAX` must give the store `max_oid = {inode, UINT64_MAX}`). It fails without the fix; with the fix the whole `osd_test` passes. ### 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 1 commit 2026-11-25 11:35:35 +03:00
A primary LIST up to max_stripe = UINT64_MAX left the store LIST upper
bound at {inode, 0}, below min_oid as soon as min_stripe > 0. Store v1
then dropped the bound and listed the rest of the PG, objects of other
inodes included, and the new store listed nothing. rm-data with such a
--max-offset deleted objects of other inodes, or nothing at all.

Set the bound the same way as the non-primary LIST does.
koolkhel force-pushed osd-primary-list-max-stripe from 88edafa39b to 8976896866 2026-11-25 15:52:16 +03:00 Compare
vitalif requested changes 2026-11-25 21:12:50 +03:00
vitalif left a comment
Owner

Ты ж там вроде где-то делал чтобы EINVAL ругалось на запросы где max < min?

Ты ж там вроде где-то делал чтобы EINVAL ругалось на запросы где max < min?
Author
Contributor

Да, это #176: он отклоняет с EINVAL запросы с max_stripe != 0 && min_stripe > max_stripe. Здесь другой случай: max_stripe = UINT64_MAX эту проверку проходит, но из-за условия max_stripe != UINT64_MAX в continue_primary_list() хранилище получает max_oid = {inode, 0}, ниже min_oid. Store v1 такую границу отбрасывает и отдаёт весь остаток PG с объектами других инодов, а vitastor-cli rm-data --min-offset X --max-offset -1 их удаляет.

Перебазировал на master с #176: test_primary_list_max_stripe_bound без этой правки падает (store получает max_oid.stripe = 0), с ней весь osd_test проходит.

Да, это #176: он отклоняет с EINVAL запросы с `max_stripe != 0 && min_stripe > max_stripe`. Здесь другой случай: `max_stripe = UINT64_MAX` эту проверку проходит, но из-за условия `max_stripe != UINT64_MAX` в `continue_primary_list()` хранилище получает `max_oid = {inode, 0}`, ниже `min_oid`. Store v1 такую границу отбрасывает и отдаёт весь остаток PG с объектами других инодов, а `vitastor-cli rm-data --min-offset X --max-offset -1` их удаляет. Перебазировал на master с #176: `test_primary_list_max_stripe_bound` без этой правки падает (store получает `max_oid.stripe = 0`), с ней весь `osd_test` проходит.
koolkhel force-pushed osd-primary-list-max-stripe from 8976896866 to 6529a09341 2026-11-25 22:51:07 +03:00 Compare
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u osd-primary-list-max-stripe:koolkhel-osd-primary-list-max-stripe
git checkout koolkhel-osd-primary-list-max-stripe
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#187
No description provided.