diff --git a/src/blockstore/blockstore_heap.cpp b/src/blockstore/blockstore_heap.cpp index 4b244cff..4a99a242 100644 --- a/src/blockstore/blockstore_heap.cpp +++ b/src/blockstore/blockstore_heap.cpp @@ -1931,15 +1931,15 @@ int blockstore_heap_t::list_objects(uint32_t pg_num, uint64_t min_inode, uint64_ stable_version = wr->version; break; } - } - if (!(first_wr->flags & BS_HEAP_STABLE)) - { - if (unstable_size >= unstable_alloc) + else { - unstable_alloc = (!unstable_alloc ? 128 : unstable_alloc*2); - unstable = (obj_ver_id*)realloc_or_die(unstable, sizeof(obj_ver_id) * unstable_alloc); + if (unstable_size >= 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) { diff --git a/src/test/test_heap.cpp b/src/test/test_heap.cpp index d75ab0c4..c73c4a58 100644 --- a/src/test/test_heap.cpp +++ b/src/test/test_heap.cpp @@ -771,6 +771,7 @@ void test_reshard_list() _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, 2, 0x80000, false); + _test_small_write(heap, dsk, 2, 0x60000, 3, 4096, 4096, 0, false); obj_ver_id *listing = NULL; 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); assert(res == 0); assert(stable_count == 4); - assert(unstable_count == 1); + assert(unstable_count == 2); free(listing); 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); assert(res == 0); assert(stable_count == 2); - assert(unstable_count == 1); + assert(unstable_count == 2); free(listing); listing = NULL; }