Educational Database Management System for Software School of Tsinghua University
Mulan Permissive Software License, Version 2
13
stars
17
forks
source link
fix: fix a bug when the same transaction inserts and deletes the same data #24
Closed
ntw2020 closed 3 months ago
问题:同一事务对同一数据进行插入和删除时存在bug
描述:当在一个事务中插入一条数据并删除这条数据后提交该事务,后续事务仍然可见这条数据
分析:OperationSet(aka unordered_set)由于无法区分INSERT和DELETE操作,将这两种操作判定为重复操作,因此DELETE操作不会被记录在IOperationSet中,导致虽然同学们编写的接口delete_record中将end_xid 设为对应负值,但是commit的时候没有记录这个删除操作,因此end_xid并未被设置为commit_id,仍为负值。于是影响后续visit_record。
解决办法:修改OperationSet的判断元素相等和计算哈希方法,使其能够区分对同一数据不同类型的操作。
感谢李祥瑞同学提供的图片!