Return all unstable versions in listing

This commit is contained in:
Vitaliy Filippov
2025-11-23 19:08:24 +03:00
parent bbf5063b25
commit 9afa3f9a13
2 changed files with 10 additions and 9 deletions
+7 -7
View File
@@ -1931,15 +1931,15 @@ int blockstore_heap_t::list_objects(uint32_t pg_num, uint64_t min_inode, uint64_
stable_version = wr->version; stable_version = wr->version;
break; break;
} }
} else
if (!(first_wr->flags & BS_HEAP_STABLE))
{
if (unstable_size >= unstable_alloc)
{ {
unstable_alloc = (!unstable_alloc ? 128 : unstable_alloc*2); if (unstable_size >= unstable_alloc)
unstable = (obj_ver_id*)realloc_or_die(unstable, sizeof(obj_ver_id) * unstable_alloc); {
unstable_alloc = (!unstable_alloc ? 128 : unstable_alloc*2);
unstable = (obj_ver_id*)realloc_or_die(unstable, sizeof(obj_ver_id) * unstable_alloc);
}
unstable[unstable_size++] = (obj_ver_id){ .oid = oid, .version = wr->version };
} }
unstable[unstable_size++] = (obj_ver_id){ .oid = oid, .version = stable_version };
} }
if (stable_version) if (stable_version)
{ {
+3 -2
View File
@@ -771,6 +771,7 @@ void test_reshard_list()
_test_big_write(heap, dsk, 1, 0x40000, 1, 0); _test_big_write(heap, dsk, 1, 0x40000, 1, 0);
_test_big_write(heap, dsk, 2, 0x60000, 1, 0x60000); _test_big_write(heap, dsk, 2, 0x60000, 1, 0x60000);
_test_big_write(heap, dsk, 2, 0x60000, 2, 0x80000, false); _test_big_write(heap, dsk, 2, 0x60000, 2, 0x80000, false);
_test_small_write(heap, dsk, 2, 0x60000, 3, 4096, 4096, 0, false);
obj_ver_id *listing = NULL; obj_ver_id *listing = NULL;
size_t stable_count = 0, unstable_count = 0; size_t stable_count = 0, unstable_count = 0;
@@ -784,7 +785,7 @@ void test_reshard_list()
res = heap.list_objects(1, INODE_WITH_POOL(1, 1), INODE_WITH_POOL(1, UINT64_MAX), &listing, &stable_count, &unstable_count); res = heap.list_objects(1, INODE_WITH_POOL(1, 1), INODE_WITH_POOL(1, UINT64_MAX), &listing, &stable_count, &unstable_count);
assert(res == 0); assert(res == 0);
assert(stable_count == 4); assert(stable_count == 4);
assert(unstable_count == 1); assert(unstable_count == 2);
free(listing); free(listing);
listing = NULL; listing = NULL;
@@ -815,7 +816,7 @@ void test_reshard_list()
res = heap.list_objects(2, INODE_WITH_POOL(1, 1), INODE_WITH_POOL(1, UINT64_MAX), &listing, &stable_count, &unstable_count); res = heap.list_objects(2, INODE_WITH_POOL(1, 1), INODE_WITH_POOL(1, UINT64_MAX), &listing, &stable_count, &unstable_count);
assert(res == 0); assert(res == 0);
assert(stable_count == 2); assert(stable_count == 2);
assert(unstable_count == 1); assert(unstable_count == 2);
free(listing); free(listing);
listing = NULL; listing = NULL;
} }