Return new_lsn from erase and rollback

This commit is contained in:
Vitaliy Filippov
2025-12-02 01:52:12 +03:00
parent db458fc999
commit 2e4d5ae5bb
5 changed files with 46 additions and 19 deletions
+10 -2
View File
@@ -1454,7 +1454,7 @@ int blockstore_heap_t::post_stabilize(object_id oid, uint64_t version, uint32_t
return 0;
}
int blockstore_heap_t::post_rollback(object_id oid, uint64_t version, uint32_t *modified_block)
int blockstore_heap_t::post_rollback(object_id oid, uint64_t version, uint64_t *new_lsn, uint32_t *modified_block)
{
uint32_t block_num = 0;
heap_object_t *obj = read_entry(oid, &block_num);
@@ -1490,6 +1490,10 @@ int blockstore_heap_t::post_rollback(object_id oid, uint64_t version, uint32_t *
}
bool tracking_active = mvcc_save_copy(obj);
++next_lsn;
if (new_lsn)
{
*new_lsn = next_lsn;
}
push_inflight_lsn(oid, next_lsn, 0);
if (!wr)
{
@@ -1507,7 +1511,7 @@ int blockstore_heap_t::post_rollback(object_id oid, uint64_t version, uint32_t *
return 0;
}
int blockstore_heap_t::post_delete(object_id oid, uint32_t *modified_block)
int blockstore_heap_t::post_delete(object_id oid, uint64_t *new_lsn, uint32_t *modified_block)
{
uint32_t block_num = 0;
heap_object_t *obj = read_entry(oid, &block_num);
@@ -1524,6 +1528,10 @@ int blockstore_heap_t::post_delete(object_id oid, uint32_t *modified_block)
auto & inf = block_info.at(block_num);
assert(inf.data);
++next_lsn;
if (new_lsn)
{
*new_lsn = next_lsn;
}
push_inflight_lsn(oid, next_lsn, 0);
erase_object(block_num, obj, next_lsn, tracking_active);
return 0;
+2 -2
View File
@@ -232,10 +232,10 @@ public:
int post_stabilize(object_id oid, uint64_t version, uint32_t *modified_block, uint64_t *new_lsn, uint64_t *new_to_lsn);
// rollback an unstable object version
// return 0 if OK, ENOENT if not exists, EBUSY if already stable
int post_rollback(object_id oid, uint64_t version, uint32_t *modified_block);
int post_rollback(object_id oid, uint64_t version, uint64_t *new_lsn, uint32_t *modified_block);
// forget an object
// return error code
int post_delete(object_id oid, uint32_t *modified_block);
int post_delete(object_id oid, uint64_t *new_lsn, uint32_t *modified_block);
// get the next object to compact
// guaranteed to return objects in min lsn order
// returns 0 if OK, ENOENT if nothing to compact
+2 -2
View File
@@ -24,7 +24,7 @@ int blockstore_impl_t::dequeue_stable(blockstore_op_t *op)
uint64_t new_to_lsn = 0;
int res = op->opcode == BS_OP_STABLE
? heap->post_stabilize(v[priv->stab_pos].oid, v[priv->stab_pos].version, &modified_block, &new_lsn, &new_to_lsn)
: heap->post_rollback(v[priv->stab_pos].oid, v[priv->stab_pos].version, &modified_block);
: heap->post_rollback(v[priv->stab_pos].oid, v[priv->stab_pos].version, &new_lsn, &modified_block);
if (res != 0)
{
assert(res == ENOENT || res == EBUSY);
@@ -34,7 +34,7 @@ int blockstore_impl_t::dequeue_stable(blockstore_op_t *op)
{
if (!priv->lsn)
priv->lsn = new_lsn;
priv->to_lsn = new_to_lsn;
priv->to_lsn = op->opcode == BS_OP_STABLE ? new_to_lsn : new_lsn;
}
priv->stab_pos++;
}
+1 -1
View File
@@ -84,7 +84,7 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
}
BS_SUBMIT_CHECK_SQES(1);
uint32_t modified_block;
int res = heap->post_delete(op->oid, &modified_block);
int res = heap->post_delete(op->oid, &PRIV(op)->lsn, &modified_block);
assert(res == 0);
prepare_meta_block_write(op, modified_block);
PRIV(op)->op_state = 5;