Skip to content

Commit

Permalink
refactoring write-recording/rollback and rogging/recovery of Update: …
Browse files Browse the repository at this point in the history
…focusing TestUndo. comment-outed dummy tupple adding but it failed...
  • Loading branch information
ryogrid committed Jun 12, 2024
1 parent d05cda6 commit 1d7fa62
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/storage/access/table_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ func (tp *TablePage) UpdateTuple(new_tuple *tuple.Tuple, update_col_idxs []int,
txn.SetPrevLSN(lsn)
}

if update_tuple.Size() < tuple_size {
// add dummy tuple which reserves space for update is aborted
tp.ReserveSpaceForRollbackUpdate(nil, tuple_size-update_tuple.Size(), txn, log_manager)
}
//if update_tuple.Size() < tuple_size {
// // add dummy tuple which reserves space for update is aborted
// tp.ReserveSpaceForRollbackUpdate(nil, tuple_size-update_tuple.Size(), txn, log_manager)
//}

// Perform the update.
free_space_pointer := tp.GetFreeSpacePointer()
Expand Down Expand Up @@ -283,6 +283,12 @@ func (tp *TablePage) ReserveSpaceForRollbackUpdate(rid *page.RID, size uint32, t
}
dummy_tuple := tuple.NewTuple(dummy_rid, size, buf[:size])
tp.setTuple(dummy_rid.GetSlotNum(), dummy_tuple)
tp.SetFreeSpacePointer(tp.GetFreeSpacePointer() - dummy_tuple.Size())
tp.setTuple(dummy_rid.GetSlotNum(), dummy_tuple)

if dummy_rid.GetSlotNum() == tp.GetTupleCount() {
tp.SetTupleCount(tp.GetTupleCount() + 1)
}

if size > 0 {
tp.SetTupleSize(dummy_rid.GetSlotNum(), SetReservedFlag(size))
Expand Down

0 comments on commit 1d7fa62

Please sign in to comment.