Allow multiple writes with the same version
This commit is contained in:
@@ -1105,10 +1105,6 @@ int blockstore_heap_t::add_object(object_id oid, heap_write_t *wr, uint32_t *mod
|
|||||||
{
|
{
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (!wr->version)
|
|
||||||
{
|
|
||||||
wr->version = 1;
|
|
||||||
}
|
|
||||||
const uint32_t wr_size = wr->get_size(this);
|
const uint32_t wr_size = wr->get_size(this);
|
||||||
// Allocate block
|
// Allocate block
|
||||||
uint32_t block_num = 0;
|
uint32_t block_num = 0;
|
||||||
@@ -1288,17 +1284,10 @@ int blockstore_heap_t::update_object(uint32_t block_num, heap_object_t *obj, hea
|
|||||||
// Stable overwrites are not allowed over unstable
|
// Stable overwrites are not allowed over unstable
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (wr->version <= first_wr->version)
|
if (wr->version < first_wr->version)
|
||||||
{
|
{
|
||||||
if (!wr->version)
|
// Overwrites with a smaller version are forbidden
|
||||||
{
|
return EINVAL;
|
||||||
wr->version = first_wr->version + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Overwrites with a smaller version are forbidden
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (modified_block)
|
if (modified_block)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,13 +185,13 @@ void test_mvcc(bool csum)
|
|||||||
|
|
||||||
assert(heap.read_locked_entry(oid, copy_id) == obj);
|
assert(heap.read_locked_entry(oid, copy_id) == obj);
|
||||||
|
|
||||||
assert(_test_do_small_write(heap, dsk, 1, 0, 1, 0, 4096, 0) == EINVAL);
|
|
||||||
|
|
||||||
_test_small_write(heap, dsk, 1, 0, 2, 8192, 4096, 16384, true);
|
_test_small_write(heap, dsk, 1, 0, 2, 8192, 4096, 16384, true);
|
||||||
obj = heap.read_entry(oid, NULL);
|
obj = heap.read_entry(oid, NULL);
|
||||||
assert(check_used_space(heap, dsk, 0));
|
assert(check_used_space(heap, dsk, 0));
|
||||||
assert(heap.get_meta_block_used_space(0) == old_size + obj->get_writes()->get_size(&heap));
|
assert(heap.get_meta_block_used_space(0) == old_size + obj->get_writes()->get_size(&heap));
|
||||||
|
|
||||||
|
assert(_test_do_small_write(heap, dsk, 1, 0, 1, 0, 4096, 0) == EINVAL);
|
||||||
|
|
||||||
assert(!heap.read_locked_entry(oid, UINT64_MAX));
|
assert(!heap.read_locked_entry(oid, UINT64_MAX));
|
||||||
assert(heap.read_locked_entry(oid, copy_id) == obj); // small_write isn't MVCCed
|
assert(heap.read_locked_entry(oid, copy_id) == obj); // small_write isn't MVCCed
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user